HTML5 and Amazon S3 Multi-Part uploads

假装没事ソ 提交于 2019-11-30 05:19:20

Yes, but you will need some kind of server backend to handle the Amazon API keys in a more secure way if you are going to make it part of a public website.

You can find what looks like a complete example implementation of this these projects:

Please note that I have not used, tested or reviewed these projects.

A rough description of the sequence is as follows:

  1. User
    • loads webpage
    • selects file to upload
    • hits upload button
  2. Webpage
    • sends info about file to server
  3. Server
    • creates multipart upload with Amazon API
    • sends "key"(filename) and "upload id" back to Webpage
  4. Webpage
    • works out size of parts
    • requests Server to sign part passing "key", "upload id", part info
  5. Server
    • signs a part request, sends "part upload url", "date" and "auth header"
  6. Webpage
    • sends part data directly to Amazon S3 via "part upload url" using "date" and "auth header"
    • keeps track of part ids
  7. Server & Webpage
    • repeats 5 & 6 for each additional part, resuming if required
  8. Webpage
    • makes "upload complete" request to server (passing all the part info)
  9. Server
    • makes request to Amazon API to complete the creation of file
  10. Webpage
    • inform user of error or success

Notes:

  • If upload is aborted, this must also be handled server side else the parts / uploads started will be left to take up space in the S3 Bucket.
  • It might take a few minutes to complete the "upload complete" request to Amazon.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!