1

How to pull multiple files using FileSystem Api (Html5) and send to javascript as an array. Actually I'm trying to select multiple files and add them to my slideshow.

Any help would be appreciated.

Regards --A.J

1 Answer 1

1

You need to add the multiple attribute to your input

 <input type="file" multiple />

You can also add webkitdirectory, directory, and/or mozdirectory to specify you want to allow users to upload entire folders. These are not standard, obviously (although plain ol' directory is/may be)

Then in your JavaScript, your input element will have a files array containing meta info on the selected files, ripe for using in the FileReader API. For example:

 <input type="file" multiple onchange="doSomethingWithThese(this.files)" />     

(I don't recommend the inline JavaScript, just for example)

Sign up to request clarification or add additional context in comments.

6 Comments

Thanks Matt Let me try this I'll post the comment back.
What I need now is the file path which i can add as array to the slideshow.
You can't get the file path. But you can use the FileReader API to get a data url, then use the data url as the src of an image in your slide show.
I've tried that but no joy, is there any possibility u could post any example here so that i can get the point.
I can't find any evidence that "mozdirectory" works for Firefox. Chrome seems to be the only browser that currently supports this.
|

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.