简体   繁体   English

从JavaScript / HTML5中的目录加载所有文件

[英]Load all files from a directory in JavaScript/HTML5

I want visitors of my websites to select a directory with files and then process them in JavaScript. 我希望我的网站访问者选择包含文件的目录,然后在JavaScript中处理它们。 I know how to let them select lots of individual files but not whole directories, which is pretty important here. 我知道如何让他们选择大量的单个文件而不是整个目录,这在这里非常重要。

How can it be done? 如何做呢? The processing of the files must be done in JavaScript. 文件的处理必须在JavaScript中完成。 It should work in newest Firefox, Chrome and, if possible, IE. 它应该适用于最新的Firefox,Chrome和IE,如果可能的话。

I cannot tell them to zip the files and then select the zip since it can be a few GB of files to process. 我无法告诉他们压缩文件然后选择zip,因为它可以处理几GB的文件。

Maybe Flash could help? 也许Flash可以提供帮助?

Found that looking for an example myself, but I did not explore the source yet. 发现自己正在寻找一个例子,但我还没有探索源。 Works on Chrome on Windows 8.1. 适用于Windows 8.1上的Chrome。 Hope this helps someone. 希望这有助于某人。

HTML5 Photo Browser for Local Files and Directories 用于本地文件和目录的HTML5照片浏览器

It uses: 它用:

\\< input type="file" id="file_input" webkitdirectory="" directory=""> \\ <input type =“file”id =“file_input”webkitdirectory =“”directory =“”>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM