后备AJAX文件上传的Internet Explorer [英] Fallback AJAX file upload for Internet Explorer

查看:159
本文介绍了后备AJAX文件上传的Internet Explorer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现用xHR2和文件API的内部项目在HTML5 AJAX的文件上传。我们只需要支持Firefox / Safari /铬。我用下面的链接作为参考

I have implemented an AJAX file uploader in HTML5 using xHR2 and File api for an internal project. We were only required to support Firefox/Safari/Chrome. I used the following links as a reference

  1. http://www.html5rocks.com/en/tutorials/file/xhr2 /
  2. http://www.html5rocks.com/en/tutorials/dnd/basics /
  3. https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications
  1. http://www.html5rocks.com/en/tutorials/file/xhr2/
  2. http://www.html5rocks.com/en/tutorials/dnd/basics/
  3. https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications

现在我需要支持的Internet Explorer 10及以下。 IE 10支持XHR2但文件API支持缺乏 有没有一种方法来检测不支持这些API是什么?如果我可以检测到不支持的API是,那么我该如何实现AJAX文件上传的IE浏览器?任何code片段,链接和教程将AP preciated。

Now I am required to support Internet Explorer 10 and below. IE 10 supports XHR2 but File API support is lacking Is there a way to detect that these APIs are not supported? If I can detect that the APIs are not supported, then how do I implement AJAX file upload for IE? Any code snippets, links and tutorials will be appreciated.

重要提示:我使用谷歌关闭JS库没有的jQuery或任何其他库。图书馆的选择是不可谈判的。我将AP preciate它,如果任何建议,不包括

IMPORTANT: I am using Google Closure JS library not jQuery or any other library. The choice of library is non negotiable. I will appreciate it if any suggestions do not include

请使用jQuery或某些那些在响应效果。

Please use jQuery or some ones to that effect in the response.

但是,使用jQuery的任何code段是完全正常的。

However, any code snippets that use jQuery are perfectly alright.

谢谢

卡尔蒂克

推荐答案

最近我一直工作在一个文件上传到与谷歌封库一起使用。我发现href="https://github.com/valums/file-uploader" rel="nofollow">细上传库是一个好的开始

Recently I've been working on a file uploader to be used together with google closure library. I found the fine-uploader library a good start. It's not written with the closure library, but it provides me the basic guidelines: uses xhr to upload a file if supported, otherwise fallback to form post into a hidden iframe.

在我的code,我实现了两个类:一个使用了 XMLHtt prequest 来上传文件,而其他使用 goog.net.IframeIo sendFromForm 方法上载文件。

In my code, I implemented two classes: one uses a XMLHttpRequest to upload a file, and the other use goog.net.IframeIo's sendFromForm method to upload a file.

这篇关于后备AJAX文件上传的Internet Explorer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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