views:

110

answers:

4

hi.. when I'm using file upload control i just get only the file name but i want to get the full path of the file location.. how to get full path from the file upload control in asp.net?

Thank you..

+4  A: 

This is not possible in any browser, as a security measure.

If this were possible, an attacker could gain information regarding how files/folders were structured on a client computer.

Why do you need this information?

Oded
A: 

You cannot get it because the browser does not send it. It would be dangerous if the browsers sent the full path at user's system.

dark_charlie
A: 

I think you got file path of the upload control

HttpPostedFile httpBrowseFile = FileUpload1.PostedFile;
int FileLength = httpBrowseFile.ContentLength;
byte[] myData = new byte[FileLength];

httpBrowseFile.InputStream.Read(myData, 0, FileLength);
FName = path + FileUpload1.PostedFile.FileName.Substring(FileUpload1.PostedFile.FileName.LastIndexOf('\\') + 1);
Aman
You think? Did you check?
Oded
this will never work
Caspar Kleijne
A: 

If you are using asp.net upload control,in client side you can get the full path like this

   document.getElementById('UploadControl').value

In server side

  UploadControl.PostedFile.FileName

Check this MSDN link for more info

Cheers

Ramesh Vel