Select folder in directory in the input

0

I need to put a input where the user selects the folder that he wants that he wants to save the notes, but only select.

I tried to do it this way:

 <input asp-for="Caminho" class="form-control" type="file" multiple webkitdirectory id="pasta">

But it appears to make upload And when I do this:

<input asp-for="Caminho" class="form-control" type="file" id="pasta">

It appears to select a file, not a folder. Is there any way I can select the folder and get the path?

EDIT

I just need to select the folder, just to be easy for the user, so he does not have to type the path in hand. Any way to do this?

    
asked by anonymous 20.12.2018 / 20:22

2 answers

1

Can not select the folder of a site using HTML native + JS . You can only select a file or list of files to upload, but not a folder itself.

Normally you will not even be able to see the original path of the file that was uploaded, and you simply can not get direct access to the user's filesystem.

Web communication is based on requests HTTP and is stateless , so there would be no way for the server to access the folder on the user's (remote) PC. And for security reasons, not even JavaScript on the client can do it.

The user can leave the downloads folder set by default in most browsers today.

    
26.12.2018 / 13:04
0

This is not possible with HTML or Javascript because of security issues.

There are solutions that try to implement this in browsers but they do not work well in all browsers, and are not at all feasible.

I also do not see much sense in this, because if you want to "save some file" browsers already make available the download folder that can be configured by the user.

    
20.12.2018 / 21:51