0

I'm using this:

<input id="fileInput" class="upload-list" type="file" webkitdirectory directory />

to open a folder, and load all the files inside the folder.

I have a .change() trigger to capture the onchange and list all the files. Every time I re-open the page, I have to manually select the folder.

Is there a way of saving the folder and opening the directory on start up?

I'm using Node Webkit (Chromium Based), so you can add some start-up lines if needed.

2
  • 1
    It seems you can get the relative path of the uploaded files, but not still not the absolute path for security reasons, so firstly you can't get the correct path, and secondly, webkitdirectory doesn't seem to accept a path as a value, it's a boolean attribute only as far as I can tell ? Commented Dec 26, 2014 at 21:54
  • Should I use nwdirectory instead? github.com/rogerwang/node-webkit/wiki/File-dialogs : "nwdirectory is a bit similar to webkitdirectory because it let user select a directory too, but it will not enumerate all files under the directory but directly returns the path of directory, developers may want to use nwdirectory to get the path of a directory" Commented Dec 26, 2014 at 22:21

1 Answer 1

1

You should use nwdirectory attribute instead of webkitdirectory. As the wiki page describes:

nwdirectory is a bit similar to webkitdirectory because it let user select a directory too, but it will not enumerate all files under the directory but directly returns the path of directory, developers may want to use nwdirectory to get the path of a directory.

So the following change fixed my problem:

<input id="fileInput" class="upload-list" type="file" nwdirectory directory />
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.