Skip to main content

Tedshd's Dev note

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);
    // progress
    console.log(Math.ceil((e.loaded/ * 100) + '%');