javascript 上传大文件的最快方法
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23973358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fastest way to upload big files
提问by user1032531
I've implemented fineuploader to upload a file without reloading the page. Problem is it is very slow and potentially fails for vary large files (~300M). Note that I am only using Fineuploader 3.1, but expect it will not make a difference to use a more current version.
我已经实现了fineuploader 来上传文件而无需重新加载页面。问题是它非常慢,并且可能会因各种大文件(~300M)而失败。请注意,我只使用 Fineuploader 3.1,但希望使用更新的版本不会有什么不同。
My question is whether I shouldn't use some sort of Ajax based file upload approach at all for large files, but based on their size fall back to some more traditional solution which reloads the page? What would be the fastest way to upload a big file using a website and not FTP, etc?
我的问题是我是否不应该对大文件使用某种基于 Ajax 的文件上传方法,但是根据它们的大小回退到一些更传统的重新加载页面的解决方案?使用网站而不是 FTP 等上传大文件的最快方法是什么?
回答by Jester
You could have a look at: Resumable.jsFault Tolerant Resumable File Uploads in JavaScript
你可以看看: Resumable.jsFault Tolerant Resumable File Uploads in JavaScript
As far as I think large files are prone to fault so it is a good idea to make it ressumable.
就我而言,大文件容易出现故障,因此使其可恢复是个好主意。
回答by Ray Nicholus
Fine Uploader has changed a lot since 3.1. The current version is already 4.4. You likely will notice a big difference if you upgrade. Also, Fine Uploader is not causing you failures, your network connection is the culprit.
Fine Uploader 自 3.1 以来发生了很大变化。当前版本已经是 4.4。如果升级,您可能会注意到很大的不同。此外,Fine Uploader 不会导致您失败,您的网络连接才是罪魁祸首。
Fine Uploader 5.0 is set to be released next week, and it includes one big feature that will help you specifically as this feature is aimed as speeding up single file large uploads: concurrent chunking. No other upload library offers this feature (it was very complicated to implement). The concurrent chunking feature has been shown to speed up single file large uploads by a factor of at least 2. It does this by sending as many chunks as possible at the same time for a single file. You can read more about this feature in the pre release notes at http://docs.fineuploader.com/branch/develop/features/concurrent-chunking.html.
Fine Uploader 5.0 将于下周发布,它包含一个大功能,可以专门为您提供帮助,因为该功能旨在加速单个文件的大上传:并发分块。没有其他上传库提供此功能(实现起来非常复杂)。并发分块功能已被证明可以将单个文件的大上传速度提高至少 2 倍。它通过为单个文件同时发送尽可能多的块来实现这一点。您可以在http://docs.fineuploader.com/branch/develop/features/concurrent-chunking.html的预发行说明中阅读有关此功能的更多信息。
Note that Fine Uploader also offers the same features as resumable.js along with many other features such as auto retry, image scaling, form support, direct uploads to S3 and Azure, and more.
请注意,Fine Uploader 还提供与 resumable.js 相同的功能以及许多其他功能,例如自动重试、图像缩放、表单支持、直接上传到 S3 和 Azure 等。