Tutorial :Fileupload Control in asp.net


I want to get full path which user selected in file upload control. how can we do it.


You can't.

The file upload will send you the file, with the filename, but nothing else. Giving you the full path on the users computer is both a possible invasion of privacy and a possible security breach, so it is not allowed.


I don't think you can do that for security reasons. This means you can get information about any user folder structure that uploads files to your web site.



browser restrictions does not allow this, however there are some hints using javascript before submiting to achieve this

For instance

<asp:button onClientClick="document.getElementById('hiddenField1').value = document.getElementById('fileUpload1').value"  ...   

Then the path can be retrieved on server side via hiddenField1.Value

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »