javascript - writeFile 方法在 IE8 中有效吗?

标签 javascript internet-explorer-8 dropbox

我正在编写 Dropbox Web 应用程序并使用 Dropbox 的客户端库: https://github.com/dropbox/dropbox-js 。 为了上传用户选择的文件,我使用 writeFile 方法。 Html 对象 File(< input type=file >) 作为参数数据传递。它在 FireFox 中运行良好。 据说这个库是针对 IE9 和 IE10 进行测试的。

writeFile 方法在 IE8 中有效吗?

如果它在 IE8 中不起作用,那么有没有办法使用 html 表单将文件上传到 dropbox?

Dropbox 文档没有给出如何通过 html 表单上传文件的示例。 有例子吗?

最佳答案

writeFile 获取文件的内容,而不是 HTML input 标记。请参阅http://coffeedoc.info/github/dropbox/dropbox-js/master/classes/Dropbox/Client.html#writeFile-instance .

这意味着您的 JavaScript 必须能够访问文件的实际内容才能使用 writeFile。 HTML5 File API可能会有所帮助,但它在 IE8 中肯定不起作用。

我认为这意味着您需要将文件上传到您自己的服务器(通过标准表单提交),然后将文件从那里传输到 Dropbox。

编辑:删除声称对文件 API 的支持普遍较差的条款。看起来没那么糟糕:http://caniuse.com/#search=file%20api

关于javascript - writeFile 方法在 IE8 中有效吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17000172/

相关文章:

javascript - 在 ie8 中使用 e.target.tagName 或 .prop 的问题

ios - Dropbox 错误 OAuth 请求 "Error 403"

javascript - 我想限制正则表达式中子域的数量

javascript - 找不到jquery输入自动完成功能

css - 仅在 IE8 中出现奇怪的渲染问题

javascript - 阻止 <enter> 在 IE8 中的文件输入上提交表单

javascript - 第一次使用 node.js - "ReferenceError: node is not defined"

javascript - Chrome 扩展浏览器操作事件未触发

java - Dropbox Java API - 文件所有者电子邮件

python - 使用 Dropbox API 上传 block