Name

XMLHttpRequestUpload

Inherits from

EventTarget

Synopsis

An XMLHttpRequestUpload object defines a set of event handler registration properties for monitoring the progress of an HTTP request body upload. In browsers that implement the XMLHttpRequest Level 2 specification, each XMLHttpRequest object has an upload property that refers to an object of this type. To monitor the progress of the request upload, simply set these properties to appropriate event handler functions or call the EventTarget methods. Note that the upload progress event handlers defined here are exactly the same as the download progress event handlers defined on XMLHttpRequest itself, except that there is no onreadystatechange property on this object.

Event Handlers

onabort

Triggered if the upload is aborted.

onerror

Triggered if the upload fails with a network error.

onload

Triggered when the upload succeeds

onloadend

Triggered when the upload finishes, whether successfully or not. A loadend event will always follow a load, abort, error, or timeout event.

onloadstart

Triggered when the upload starts.

onprogress

Triggered repeatedly (approximately every 50ms) while the upload is occurring.

ontimeout

Triggered if the upload is aborted because the XMLHttpRequest timeout expired.

Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.