HTML5 FileReader 替代方案
我需要一些有关 HTML5 的帮助。我有一个脚本可以循环遍历所有上传的文件并获取每个文件的详细信息。目前我正在使用包括 FileReader 在内的 HTML5 技术。 FileReader 功能仅适用于 Chrome 和 Firefox,因此我正在寻找一种适用于所有其他浏览器的替代方案。
我看到了 Stack Overflow 问题FileReader HTML 5 API 的 Flash 替代方案,但我无法弄清楚如何使用这个 Flash 东西,并且没有任何其他解决方案,以便我可以循环遍历所有上传的文件并获取每个文件的详细信息(这将在野生动物园和互联网浏览器)?
I need some help with HTML5. I have a script that loops through all the uploaded files and gets each file details. Currently I am using HTML5 techniques that include FileReader. The FileReader function only works in Chrome and Firefox, so I am looking for an alternative which will work in all of the other browsers.
I saw the Stack Overflow question Flash alternative for FileReader HTML 5 API, but I wasn't able to figure how to use this Flash thing, and aren't there any other solutions so I can loop through all of the uploaded files and get each file details (which will work in Safari and Internet Explorer)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最终根本没有使用 FileReader,而是循环遍历 event.files 并通过 files[i] 获取每个文件,并通过 XHR 使用 FormData 对象发送 AJAX 请求(对我有用,因为我决定不需要获取文件数据):
Ended up not using FileReader at all, instead I looped through event.files and got each file by files[i] and sent an AJAX request by XHR with a FormData object (worked for me because I decided I don't need to get the file data):
Safari 是第一个真正实现 HTML5 文件 API 的浏览器,并且有几个演示。 Andrea Giammarchi 他的博客上有一个很好的描述。有几个框架可以处理这个问题,它们也有 Internet Explorer 的后备方案。 Fancyupload 是我想到的一个。
Safari was the first one to actually implement the HTML5 file API, and there are several demos. Andrea Giammarchi has a nice description on his blog. There are several frameworks to handle this as well which also have fallbacks for Internet Explorer. Fancyupload is one that comes to mind.