如何拉多个文件html5 jquery [英] how to pull multiple files html5 jquery
问题描述
其实我试图选择多个文件并将它们添加到我的幻灯片中。
任何帮助将不胜感激。
问题
--AJ
您需要添加多个
属性到您的输入
< input type =filemultiple />
您也可以添加 webkitdirectory
,目录
和/或 mozdirectory
来指定您想允许用户上传整个文件夹。这些都不是标准的,显然(尽管普通的ol 目录
是/可能的)然后在你的JavaScript中,您的输入元素将有一个文件
数组,包含所选文件的元信息,可以在FileReader API中使用。例如:
< input type =filemultiple onchange =doSomethingWithThese(this.files)/>
(例如,我不建议使用内联JavaScript)
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
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)
这篇关于如何拉多个文件html5 jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!