I'm trying to use a file upload in a CMS website. The below code works fine, but I'm wondering if there isn't a better/easier way to get it done.
I tried using: FileUpload1.SaveAs("~\file
I also tried using: FileUpload1.SaveAs("..\fil
Neither of which worked. Is there a way to upload into that directory without using the actual folder name? I want to be able to move this to another folder later and want to use relative path if possible.
If FileUpload1.HasFile Then
FileUpload1.SaveAs("C:\Web Sites\devBoyScouts\files\" & _
Label1.Text = "File name: " & _
FileUpload1.PostedFile.FileName & "<br>" & _
"File Size: " & _
FileUpload1.PostedFile.ContentLength & " kb<br>" & _
"Content type: " & _
Catch ex As Exception
Label1.Text = "ERROR: " & ex.Message.ToString()