ALi Jay
ALi Jay

Reputation: 11

how to pull multiple files html5 jquery

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

Upvotes: 1

Views: 1382

Answers (1)

Matt Greer
Matt Greer

Reputation: 62027

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)

Upvotes: 1

Related Questions