I\'m trying to make a file uploader with HTML5 with a progress meter. Here\'s my code:
Test
I had the same problem like yours, then I tried my page from another computer, everything just went OK, I did use Chrome's network throttling to simulate a slow internet connection but it seems that there are still something different from real situation
Because the server or the gateway cache the request data immediately, write the file data to the disk or memory. At this time, the file data progress indeed is 100%. But the server's logic code has not yet finish process the file data which is just cached in the server.
this is my code and it's work fine for me:
xhr.upload.onprogress = function(e){
var done = e.position || e.loaded, total = e.totalSize || e.total
var present = Math.floor(done/total*100)
document.getElementById('status').innerHTML = present + '%'
}