4

I am using AWS S3 Javascript sdk to upload files to my S3 bucket via my browser. I had no problem fetching files or uploading small and even huge files with the multi-part upload normally.

The issue I faced was while uploading a huge file and lost my connection in between. After the connection returned, the request was resend for the remaining parts to be uploaded but failed.

I have attached a screenshot of the failed requests

enter image description here

Any reason why this fails, or any way this can be handled/resolved?

Eliza A
  • 152
  • 5

1 Answers1

6

When you are uploading a huge set of data, you can try including a class ManagedUpload for multi-part uploading. You need to specify the bucket size, however. A sample code of this fromt the documentation would be:

var upload = new AWS.S3.ManagedUpload({
  partSize: 10 * 1024 * 1024, queueSize: 1,
  params: {Bucket: 'bucket', Key: 'key', Body: stream}
});

Where, the partSize (Number), by default, the value is 5mb is the size in bytes for each individual part to be uploads.

There's also an open source project in GitHub: AWS S3 Multipart Upload from Browser, which is written in JavaScript and PHP to make huge files to be uploaded in Amazon S3 server directly, in chunks of 5 MB, so it is resumable and recovers easily from error.

Guessing that to use the above plugin, you might have to use PHP. There's also a limit on maximum upload size per file. Please do have a look at it.

Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252