Rails 哪一个 ajax 文件上传框架跨平台能力最好?

crazyjin · September 09, 2013 · Last by huobazi replied at September 10, 2013 · 7342 hits

我正在做一个跨平台 web 应用。我希望它能适应从智能手机到平板到 pc。我用了 jquery、bootstrap。然后,我需要一个 ajax 文件功能,后台用 carrierwave,前端框架正在找。有没有满足跨平台需要的 ajax 文件上传框架呢?哪一个?求推荐。谢谢。。

第一个推荐:jQuery File Upload https://github.com/blueimp/jQuery-File-Upload 对 pc 和 android 的支持都很好,ios 的支持欠缺了一点。Iphone4s 用的都还是 safari5.0。

Desktop browsers

The File Upload plugin is regularly tested with the latest browser versions and supports the following minimal versions: Google Chrome Apple Safari 4.0+ Mozilla Firefox 3.0+ Opera 11.0+ Microsoft Internet Explorer 6.0+ Mobile browsers

The File Upload plugin has been tested with and supports the following mobile browsers: Apple Safari on iOS 6.0+ Google Chrome on iOS 6.0+ Google Chrome on Android 4.0+ Default Browser on Android 2.3+ Opera Mobile 12.0+

FEATUERS Multiple file upload: Drag & Drop support: Upload progress bar: Cancelable uploads: Resumable uploads: Chunked uploads: Client-side image resizing: Preview images, audio and video: No browser plugins (e.g. Adobe Flash) required: Graceful fallback for legacy browsers: HTML file upload form fallback: Cross-site file uploads: Multiple plugin instances: Customizable and extensible: Multipart and file contents stream uploads: Compatible with any server-side application platform:

第二个强大的存在:Fine Uploader https://github.com/Widen/fine-uploader 搞不懂为啥用的是 GPLv3,下载又要买 License。

BROWSER SUPPORT Does NOT require Flash, jQuery, or any external libraries.

IE7+ (including IE10) Firefox Safari (OS X) Chrome IOS6 Android

FEATURES Multiple file select, progress bar Drag-and-drop to upload Cancel uploads Auto and manual upload Customizable failure messages Auto/manual retry Multiple built-in validation rules Custom validation rules Over a dozen possible callbacks Send parameters with each file Upload directories via drag & drop Submit files via the API File chunking/partitioning Resume previously failed/interrupted files Delete uploaded files CORS (cross-origin) support Paste to upload Upload from mobile camera Edit file names Upload directly to Amazon S3

前端没有真正意义上的 ajax 文件上传,在不使用 flash/activex/applet 等插件的情况下,只能使用 iframe 模拟异步上传,本质上是一次 form 提交。 如果需要支持手机,平板,需要使用 iframe 方式模拟的 ajax 上传控件。

#1 楼 @xds2000 看来是我没有认真看它的介绍,这款框架人气是最高的。。跨平台性也很好。。谢谢 Desktop browsers

The File Upload plugin is regularly tested with the latest browser versions and supports the following minimal versions:

Google Chrome Apple Safari 4.0+ Mozilla Firefox 3.0+ Opera 11.0+ Microsoft Internet Explorer 6.0+ Mobile browsers

The File Upload plugin has been tested with and supports the following mobile browsers:

Apple Safari on iOS 6.0+ Google Chrome on iOS 6.0+ Google Chrome on Android 4.0+ Default Browser on Android 2.3+ Opera Mobile 12.0+

#4 楼 @Rei thx... HTML5 XMLHttpRequest 第二版规范支持 ajax 文件上传,顿时感觉落伍了。 翻出一篇之前收藏的文章,讲解的很详细。 http://www.ruanyifeng.com/blog/2012/08/file_upload.html

查了一下兼容性,File API IE9 不兼容,至少 IE10 http://html5test.com/results/desktop.html

#6 楼 @shawnyu 用过一次。。貌似 Uploadify 的 flash 上传不带 session。服务器端需要做处理。。

我顶一下楼上的,之前我用的是 remotipart,然后直接上传,最近改用 fineuploader 了,不错

一直用 jQuery-File-Upload 各种好用啊,没啥可挑的。

Fineuploader 这玩意儿还要这么贵?

#11 楼 @larryzhao 哦 这个是 GPL 的

#9 楼 @huobazi fineuploader 貌似比 jquery-file-upload 要强大些。。

#12 楼 @huobazi 为啥下载要买 License?

You need to Sign in before reply, if you don't have an account, please Sign up first.