Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In <strong>script.js</strong> move:</p> <pre><code>// OPEN THE AJAX REQUEST ajaxReq.open('POST', 'upload/uploader'); // Set the header of the POST request ajaxReq.setRequestHeader('Cache-Control', 'no-cache') // send the file. remember, we shoud pass a formData object as an argument to the xhruest.send(); ajaxReq.send(formObj); </code></pre> <p>outwith the progress event listener:</p> <pre><code> ajaxReq.upload.addEventListener('progress', function(event) { console.log('this is a very good.'); // first let's get the amount of the file loaded. it is in decimals var percent = event.loaded / event.total; // get the name of the element that the progress-indicator is outputted there if(event.lengthComputable) // if a file is inserted and everything is just OK for uploading { if(progressBar.hasChildNodes()) // cleans the div container for a new progress to display { progressBar.removeChild(progressBar.firsChild); } progressBar.appendChild(document.createTextNode('The Progress So Far: '+percent*100+' %')); } // END OF PROGRESS OF THE FILE ///////////////////////////////////////////// // LOAD OF THE FILE ///////////////////////////////////////////// ajaxReq.upload.addEventListener('load', function(event) { progressBar.appendChild(document.createTextNode(" Completed!")); }); // END OF LOAD OF THE FILE ///////////////////////////////////////////// // ERROR OF THE FILE ///////////////////////////////////////////// ajaxReq.upload.addEventListener('error', function(event) { progressBar.removeChild(); progressBar.appendChild(document.createTextNode("Failed to Upload the File.")); }); // END OF THE ERROR OF THE FILE ///////////////////////////////////////////// // JSON }); // OPEN THE AJAX REQUEST ajaxReq.open('POST', 'upload/uploader'); // Set the header of the POST request ajaxReq.setRequestHeader('Cache-Control', 'no-cache') // send the file. remember, we shoud pass a formData object as an argument to the ajaxRequest.send(); ajaxReq.send(formObj); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload