分段文件上传和分块文件上传有什么区别?哪种方法更有效?

What is the difference between a multipart file upload and a chunked file upload ? Which approach is more efficient?

我目前正在尝试将文件上传到 Alfresco CMS,我有两种方法

  1. 使用提交文件作为多部分 POST 请求
  2. 从客户端将文件作为块上传,然后使用 Web 脚本在 Alfresco 端重新组合块。

哪种方法更好,为什么?

我在网上对这两种方法做了一些研究

difference between multipart and chunked protoccol

Why is form enctype=multipart/form-data required when uploading a file?

但还是无法定论优劣

PS:上传文件的大小范围为 5 MB 到 2 GB。

我认为使用第二种方法

Upload the file as chunks from the client and then reassemble the chunks on the Alfresco side using Web Scripts

会更好,原因是表单提交是同步的,并且会阻止浏览器使用,直到整个文件上传完毕,在您的情况下相当大,使用客户端脚本发送数据将使您能够显示上传进度到end-user 并为您提供 resume/restart 上传的能力,以防文件上传期间出现任何网络错误。

您可以阅读这篇文章了解更多详情http://creativejs.com/tutorials/advanced-uploading-techniques-part-1/