I am doing direct upload to S3 using html form and ajax. It works well, files are uploaded. My problem is that progress events arrive too fast. Like all of them, up to 99.9% quit immediately at the beginning of the download.
var fd = new FormData(); // put data from the form to FormData object $.each( $('#upload-form').serializeArray(), function(i, field) { fd.append(field.name, field.value); }); // add selected filename to the form data var file = document.getElementById('path-to-file').files[0]; fd.append("file", file); var xhr = getXmlHttpRequest(); // cross-browser implementation xhr.upload.addEventListener("progress", function(e) { console.log(e.loaded + "/" + e.total); }); xhr.open('POST', 'http://mybucket.s3.amazonaws.com/', true); xhr.send(fd);
also tried this way
xhr.upload.onprogress = function(evt) { if (evt.lengthComputable) { console.log(e.loaded + "/" + e.total); } };
The browser history is as follows:
[22:54:47.245] POST http:
and then nothing in the time it actually takes to download the 5M file.
If the browser information is current, I have Firefox 20.0.1
source share