Article From:

Similar to this.

Answer 0:

With XmlHttpRequest, you can get the uploaded data length, and with the total length, you can calculate the upload progress in the programs event

Answer 1:

You can bind the progress event to get the progress of the data transferred when you make an HTTP request from the XMLHttpRequest object

    var request = new XMLHttpRequest();                 
       "POST", "1.php",true);
                 request.onreadystatechange = function(){                    
                request.upload.addEventListener('progress',progress, false);            
         function progress(e){
                    var percentComplete = Math.round(e.loaded/ * 100 )+"%";
                    //total The total file size loaded is the size of the upload.}}

Leave a Reply

Your email address will not be published. Required fields are marked *