无需上传即可访问Web应用程序中的文件内容 [英] Accessing contents of a file in a web-application without uploading

查看:145
本文介绍了无需上传即可访问Web应用程序中的文件内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,除非首先上传到服务器,然后重新下载到用户,否则无法在Web应用程序中访问用户计算机上的文件内容,除非使用某种插件。 (Flash等)理想情况下,用户可以将文件直接上传到localstorage,然后脚本就有机会处理/显示/验证/过滤而无需用户等待上传。

As far as I can tell, it is impossible to access the content of files on the user's computer in a web application without first uploading to the server, then re-downloading to user, unless some sort of plug-in is used. (Flash, etc.) Ideally, the user would upload the file directly to localstorage and then scripts would have a chance to process/display/validate/filter without the user having to wait on an upload.

在即将推出的网络标准中是否有任何功能,如html5,这将允许这个?如果没有,为什么没有努力使这成为可能,我怎么能解决它而不会卡住插件?

Are there any features in upcoming web standards such as html5 that will allow this? If not, why has there been no effort to make this possible, and how can I work around it without getting stuck with plugins?

编辑: 不要以为我想让JavaScript在没有任何用户干预的情况下访问硬盘上的任意文件。 我们已经能够提示用户输入文件并上传它,我只想提示用户将文件加载到浏览器的内存中。 我只希望HTML5支持你已经可以用Flash和Java小程序做的事情。

推荐答案

不是文件API( http://www.w3.org/TR/FileAPI / )这样做?

Doesn't the File API ( http://www.w3.org/TR/FileAPI/ ) do that ?

它在Firefox 3.6中实现(参见 https://developer.mozilla.org/en/DOM/FileReader https://developer.mozilla.org/en/Using_files_from_web_applications

It's implemented in Firefox 3.6 (see https://developer.mozilla.org/en/DOM/FileReader and https://developer.mozilla.org/en/Using_files_from_web_applications )

根据 http://code.google.com/events/io/2010/sessions/html5-status- chrome.html支持chrome.html。

According to http://code.google.com/events/io/2010/sessions/html5-status-chrome.html it is supported in chrome.

这篇关于无需上传即可访问Web应用程序中的文件内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆