本文介绍了上传前拆分文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在网页上,是否可以在文件上传到服务器之前将大文件拆分成块?例如,将一个 10MB 的文件拆分为 1MB 的块,并在显示进度条的同时一次上传一个块?

On a webpage, is it possible to split large files into chunks before the file is uploaded to the server? For example, split a 10MB file into 1MB chunks, and upload one chunk at a time while showing a progress bar?

听起来 JavaScript 没有任何文件操作能力,但 Flash 和 Java 小程序呢?

It sounds like JavaScript doesn't have any file manipulation abilities, but what about Flash and Java applets?

这需要在 IE6+、Firefox 和 Chrome 中工作.更新:忘记提及 (a) 我们正在使用 Grails 并且 (b) 这需要通过 https 运行.

This would need to work in IE6+, Firefox and Chrome. Update: forgot to mention that (a) we are using Grails and (b) this needs to run over https.

推荐答案

你可以试试Plupload.它可以配置为检查用户端可用的任何运行时,无论是 Flash、Silverlight、HTML5、Gears 等,并首先使用满足所需功能的任何一个.除其他外,它支持图像大小调整(在用户方面,保留 EXIF 数据(!))、流式和分段上传以及分块.文件可以在用户端分块,并逐块发送到服务器端处理程序(需要对服务器进行一些额外的照顾),以便大文件可以上传到最大文件大小限制设置为低得多的值的服务器然后它们的大小,例如.还有更多.

You can try Plupload. It can be configured to check whatever runtime is available on users side, be it - Flash, Silverlight, HTML5, Gears, etc, and use whichever satisfies required features first. Among other things it supports image resizing (on users side, preserving EXIF data(!)), stream and multipart upload, and chunking. Files can be chunked on users side, and sent to a server-side handler chunk-by-chunk (requires some additional care on server), so that big files can be uploaded to a server having max filesize limit set to a value much lower then their size, for example. And more.

我相信有些运行时支持 https,有些需要测试.无论如何,这些天那里的开发人员非常敏感.所以你至少可以尝试;)

Some runtimes support https I believe, some need testing. Anyway, developers on there are quite responsive these days. So you might at least try ;)

这篇关于上传前拆分文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 00:50