xMilos
xMilos

Reputation: 2018

Html get user local directory path

On my web app i have a textbox where client have to enter a path eg. C:\test and in that folder a file will be generated. The question is instead of manualy writing C:\test is there a way he can get this directory path with window that explores his system - like when uploading file.

Upvotes: 2

Views: 1356

Answers (1)

J.Joseph
J.Joseph

Reputation: 234

The common use case is, the user clicks on a link and a file will be downloaded into his machine. This is usually done with anchor tag and the HTML5 download attribute. Here is an example:

<a href="~/images/abc.jpg" download>Click here to download </a>

The download action will be depended on the user's browser settings. In google chrome there is an option

"Ask where to save each file before downloading" enter image description here

if it is checked, user will get a file explorer pop-up to select the download location.

Upvotes: 2

Related Questions