Alexandr Docker
Alexandr Docker

Reputation: 75

Get full path to file from FileUpload

I update database from excel using FileUpload (ASP .NET).

<asp:FileUpload ID="File1" runat="server" Text="File..."/>

When I'm using IE11 I can get path to file from PC. But I can't get path to file when I'm using Chrome (Opera). How can i get a full path from FileUpload?

I try get path:

 //get full path   
 string path = System.IO.Path.GetDirectoryName(file.PostedFile.FileName);

but it is work only with IE.

Upvotes: 1

Views: 2445

Answers (1)

Emre Kabaoglu
Emre Kabaoglu

Reputation: 13146

Why do you need the full path of client I don't know, but you can't retrieve client file path. Because, modern browsers don't provide that information for security reasons. Imagine that, if you get the full path, it would give you some critical informations about the client and its file system or network mapping.

So, it is not possible. Also, i don't know maybe there is a setting on browsers to give upload path information even so only the client must decide it to provide this information.

Upvotes: 1

Related Questions