Hello,
I am trying to upload files using CopyTo function of FileInfo.
The code I am using is as follows...
FileInfo fileObj = new FileInfo(filUpload1.PostedFile.FileName);
string fileType = filUpload1.PostedFile.ContentType;
string newFileName = "test.txt";
string folderPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Uploads");
fileObj.CopyTo(folderPath + "\\" + newFileName);
The exception I am getting is...
Could not find file 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\help.txt'.
Help.txt is the name of the file I selected using FileUpload control.
I could have used the SaveAs function of FileUpload control but I want to try it using above method. The files gets successfully uploaded when I do it on my machine but after uploading it on web server, it throws the above exception.
Please suggest.
Thank You. ...
Go to the complete details ...