file upload show progress bar
Table of Contents
#
file upload show progress bar
If you want show upload progress, you must use AJAX method. And you upload files use FormData object. XMLHttpRequest object has upload properties XMLHttpRequest nsIXMLHttpRequestEventTarget
sample code
xmlHttpRequest.upload.onprogress = function (e) {
console.log('onprogress', e);
console.log(e.loaded);
// progress
console.log(Math.ceil((e.loaded/e.total) * 100) + '%');
};