Upload to Amazon S3 server directly from browser in chunk and resumable way

UPDATE: This works for AWS sdk version 2.4.0. AWS sdk version 2.4.1 throws body missing exception.

I have written some javascript and php code to make big local files to be uploaded in Amazon S3 server directly, in chunk of 5 MB (amazon web service says that the chunk size should be at least 5MB), so the upload is resumable and recover easily from upload or network error.

To make this work we need our browsers to be able to read local files and send the data to cross-domain server with XMLHttpRequest2. Most mainstream browsers’ recent versions support these operations (Firefox, Chrome, Opera, IE, etc. and some mobile browsers also)

So what do we need? We also need a signing server which will sign the request we will send to the S3 server from browser (Why signing needed? Because we should not allow anybody to upload or manipulate our S3 bucket, shall we?). In my demonstration I used php backend server, but any backend can be used.

If you need a demonstration for inspiration or a starting point for your project, you can look at these source codes here – https://github.com/ienzam/s3-multipart-upload-browser

Please put your valuable comments ans suggestions.

Thank you all for reading.