我目前正在尝试将文件上传到 Alfresco CMS,我有两种方法
- 使用提交文件作为多部分 POST 请求
- 从客户端将文件作为 block 上传,然后使用 Web 脚本在 Alfresco 端重新组合 block 。
哪种方法更好,为什么?
我在网上对这两种方法做了一些研究
difference between multipart and chunked protoccol
How does HTTP file upload work?
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
会更好,原因是表单提交是同步的,并且会阻止浏览器使用,直到上传整个文件,在您的情况下这非常大,使用客户端脚本发送数据将使您能够显示上传进度到结束 -用户并为您提供在文件上传过程中出现任何网络错误时恢复/重新开始上传的能力。
您可以阅读这篇文章了解更多详情http://creativejs.com/tutorials/advanced-uploading-techniques-part-1/
关于javascript - 分段文件上传和分块文件上传有什么区别?哪种方法更有效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34510376/