Click here to Skip to main content
15,886,045 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have one configuration screen.
I created one textbox with browse button option
. I want to save the folder name into my database. Kindly Advise

What I have tried:

<input class="form-control form-control-lg" id="formFileLg" type="file" />
Posted
Updated 26-May-23 20:50pm

1 solution

You can use webkitdirectory for this. Please see an example here
https://codepen.io/simevidas/pen/ZJjmWG
 
Share this answer
 
Comments
AMARNATH REDDY SURAPUREDDY 27-May-23 2:51am    
It will give file names in the directory.

but we want directory name

***
Ex : If i select C://me.
it's gonna print C://me in console.

it's giving all files inside C://me.
Richard Deeming 30-May-23 5:10am    
Web applications have extremely limited access[^] to the local filesystem, and with good reason. Would you really want every random website you visited being able to access random locations on your computer's hard-drive?

You can get access to a restricted part of the filesystem; or you can get the user to select one or more files to upload. But you cannot get the actual path of those files, and you cannot get the path of a directory on their computer.

And if you think about it, even if you could, it wouldn't do you any good. A path on my computer won't make any sense to code running on your computer. So unless both the server and the client are part of the same internal network, and you could somehow restrict the selection to UNC paths on that network, there's no benefit to your code to know the path/name of the directory selected by the user.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900