1

Is there a way to get the select file dialog box open and putting the location of the file into a textbox without ever uploading the file?

ETA I'm using VB.NET in a web page. By using the asp:fileupload tag I can get the file location

_fudFileLocation.PostedFile.FileName_

But how do I prevent the file from being uploaded at all. We don't need it, just the file location. (The files are on a shared drive so if it's M:\documents\todayslunch.pdf for person A, it's the same for person B.)

Alverant
  • 229
  • 2
  • 5
  • 13

2 Answers2

0

You do not get access to the full filepath in the browser because of security.

If this was possible, one could get the full layout of the computer of anyone going to any website.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • But you have full access via the browse for file dialog box. I was able to get the code here: fudFileLocation.PostedFile.FileName so I just need to know how to prevent the file from being uploaded in the first place since we're not using it. – Alverant Apr 25 '12 at 21:27
  • @Alverant - A filename is not the same as the path. As for not uploading the file - once the user clicked the button, that's it. You can choose not to save it, but you can't stop it from being transferred. – Oded Apr 25 '12 at 21:44
  • System.Web.HttpPostedFile.FileName gets the fully qualified name of the file on the client which includes the directory path. – Alverant Apr 26 '12 at 15:32
  • @Alverant - Only on IE. And it is still a security risk. – Oded Apr 26 '12 at 15:32
0

System.Web.HttpPostedFile.FileName gets the fully qualified name of the file on the client which includes the directory path.

Alverant
  • 229
  • 2
  • 5
  • 13