I'm trying to calculate the actual file upload time in fact with this code I find the remaining time in% of the file upload, but it doesn't work, because when it reaches 100% and I refresh the page, the files haven't yet been moved to the destination folder but I have to wait before they are moved. Any solution?
xhr: function(){
var xhr = new window.XMLHttpRequest();
var started_at = new Date();
xhr.upload.addEventListener( 'progress', function(e){
if( e.lengthComputable ){
var loaded = e.loaded;
var total = e.total;
var progressValue = Math.round( ( loaded / total ) * 100 );
$('section.gallery .row div .content-progress-bar .progress .progress-bar').width(progressValue+'%').change();
}
}, false );
return xhr;
}