xhrupload
XHRUpload is the interface used in the XMLHttpRequest API to manage the upload portion of a request. It is exposed via the xhr.upload property and is commonly used to monitor and control file uploads initiated with XMLHttpRequest.
The XHRUpload interface was introduced with HTML5 to enable progress and state events for the request payload,
The XHRUpload object emits events such as progress, loadstart, load, loadend, error, and abort. The progress
Usage typically involves attaching a listener to xhr.upload and then sending the request with the payload,
var xhr = new XMLHttpRequest();
xhr.open('POST','upload.php');
xhr.upload.addEventListener('progress', function (e) {
console.log('Uploaded ' + e.loaded + ' of ' + e.total);
}
}, false);
Compatibility and limitations: XHRUpload is supported in most modern browsers, but behavior can vary across environments.