我正在编写 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/