This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

upload

Summary

Returns the associated XMLHttpRequestUpload object. It can be used to gather transmission information when data is transferred to a server.

Property of apis/xhr/XMLHttpRequestapis/xhr/XMLHttpRequest

Syntax

Note: This property is read-only.

var result = element.upload;

Return Value

Returns an object of type

XMLHttpRequestUpload. Each XMLHttpRequest object has an associated XMLHttpRequestUpload object.

Examples

function transferComplete(evt) {
  alert("The transfer is complete.");
}

function transferFailed(evt) {
  alert("An error occurred while transferring the file.");
}

function transferCanceled(evt) {
  alert("The transfer has been canceled by the user.");
}

var xhr= new XMLHttpRequest();

xhr.upload.addEventListener("load", transferComplete, false);
xhr.upload.addEventListener("error", transferFailed, false);
xhr.upload.addEventListener("abort", transferCanceled, false);

xhr.open();

Related specifications

W3C XMLHttpRequest Specification
W3C Working Draft

Attributions