ASP.NET - upload file using filepath - Asked By Anandh Ramanujam on 24-Jun-11 10:23 AM
I am having a file path (ex. C:\TCO\uploadfile.pdf).
How can i upload file from this path.
Can we do without using Fileupload control, or can we assign the path to a new FileUpload object??
Peter Bromberg replied to Anandh Ramanujam on 24-Jun-11 10:51 AM
The user has to select the path due to browser security restrictions. There is no workaround.
dipa ahuja replied to Anandh Ramanujam on 24-Jun-11 11:01 AM
string filename = @"d:\test.txt";
string savePath = Server.MapPath("status");
string s = savePath + "/" + Path.GetFileName(filename);
Anandh Ramanujam replied to dipa ahuja on 24-Jun-11 11:49 AM
This will work in our localhost..
But when application is moving to different server.. This will not work as it will search the path in the server.
dipa ahuja replied to Anandh Ramanujam on 24-Jun-11 11:52 AM
If your path is fix then it will work... if you path is changing then you have to use the file upload .. there is no other option