HTML 5 文件 API
我听说 Firefox 3.6 添加了对 HTML 本地文件 API 的支持 (此处公告)。
这是否意味着我可以从 javascript 访问本地文件?
谁能指出我读取/写入本地文件的示例?
我希望能够读取/写入简单的文本文件。
I hear that Firefox 3.6 adds support for the HTML local file API (Announcement here).
Does this mean that I can access local files from javascript?
Can anyone point me to examples for reading / writing local files?
I would love to be able to read / write simple text files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以访问的唯一文件是从桌面删除的文件或从
标记中选择的文件。请参阅我在这里编写的演示: http://hacks.mozilla .org/2009/12/uploading-files-with-xmlhttprequest/
The only files you can access are files dropped from the desktop or files that has been selected from an
<input/>
tag. See the demo I've written here: http://hacks.mozilla.org/2009/12/uploading-files-with-xmlhttprequest/它不允许访问任意本地文件。它更多的是文件上传的改进。例如,您可以让某些 Javascript 接受浏览器用户发起的拖放文件。
您可以在此处找到 W3C 规范。
It doesn't allow accessing arbitrary local files. It's more of a file upload improvement. For instance, you can have some Javascript accept a drag-and-drop file initiated by the user of the browser.
You can find the W3C spec on it here.
请访问 hacks.mozilla.org。
Take a look at the demo at hacks.mozilla.org.
您可以在 Mozilla 开发中心 上找到该 API 的特定于 mozilla 的说明。
You can find a (mozilla-specific explanation of the API on the Mozilla Development Center.
可以写入本地文件系统,但用户必须完成“另存为...”操作。目前,无法直接访问客户端文件系统。看看这里
It's possible to write to local file system, but the user must complete a 'save as...' action. For now, no direct access to client file system. Take a look here