问题
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.)
回答1:
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.
回答2:
System.Web.HttpPostedFile.FileName gets the fully qualified name of the file on the client which includes the directory path.
来源:https://stackoverflow.com/questions/10322936/browse-for-file-window-without-uploading-the-file