Why would you want to show a file/folder dialog on the server-side?
I'm building a project that is intended to be ran locally (both the Node server-side part and client-side in the browser), where I'd like to be able to select a path, add it to some list or JSON file, and then maintain some projects in it (webpack'ing, read files, serve via express, etc).
Mostly just for personal use, for now anyways.
The reason I ask to do this via Node instead of the browser is so I can somehow get around the security implications in modern browsers that prevents, upon selecting a folder, from revealing the full local folder paths on the client-side (from an <input>
tag).
Not only that, but I also:
- DON'T need to upload any files, or
- DON'T need the list of files contained in the selected folder.
I just need:
- a way to pick a folder in a user-friendly manner, and...
- submit it's path to the server
- (or have the server prompt for it, and store it somewhere).
Take this input
tag for example:
<input id="open-project" type="file" />
This will result this type of popup, which is great for digging into folders, pasting portions of paths to quickly navigate where you need, go to your Quick Access / Favorites, etc...
But it's intended for selecting files, with no paths exposed, nothing useful to pass on to the server.
However...
If you switch it to this...
<input id="open-project" type="file" webkitdirectory directory />
You end up with this dreadful dialog box, which assumes you want to upload ALL THE FILES contained in the folder.
So it doesn't really look like <input>
is the way to go.
Maybe there's an existing module that does this on the server-side? That way I could:
- 'Invoke' it from the client-side, via AJAX for example
- which would then trigger it on the server
- and then show me the folder-select prompt
Or...
Make, a... tree-view in the browser... that communicates back-and-forth with the node side to dig down the local filesystem...
Any suggestions?