title: UploadTask
sidebar_label: UploadTask
Listens on the upload progress change event and cancels upload tasks.
Reference
Methods
abort
Aborts upload tasks.
Reference
() => void
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
UploadTask.abort |
✔️ |
|
offHeadersReceived
Listens on HTTP Response Header event, which will be earlier than the request completion event.
Reference
(callback: OffHeadersReceivedCallback) => void
Property |
Type |
Description |
callback |
OffHeadersReceivedCallback |
The callback function for the HTTP Response Header event. |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
UploadTask.offHeadersReceived |
✔️ |
|
offProgressUpdate
Un-listens on the upload progress change event.
Reference
(callback: OffProgressUpdateCallback) => void
Property |
Type |
Description |
callback |
OffProgressUpdateCallback |
The callback function for the upload progress change event. |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
UploadTask.offProgressUpdate |
✔️ |
|
onHeadersReceived
Listens on HTTP Response Header event, which will be earlier than the request completion event.
Reference
(callback: OnHeadersReceivedCallback) => void
Property |
Type |
Description |
callback |
OnHeadersReceivedCallback |
The callback function for the HTTP Response Header event. |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
UploadTask.onHeadersReceived |
✔️ |
|
headersReceived
(callback: OnHeadersReceivedCallback) => void
Property |
Type |
Description |
callback |
OnHeadersReceivedCallback |
The callback function for the HTTP Response Header event |
onProgressUpdate
Listens on the upload progress change event.
Reference
(callback: OnProgressUpdateCallback) => void
Property |
Type |
Description |
callback |
OnProgressUpdateCallback |
The callback function for the upload progress change event. |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
UploadTask.onProgressUpdate |
✔️ |
|
progress
(callback: OnProgressUpdateCallback) => void
Property |
Type |
Description |
callback |
OnProgressUpdateCallback |
The callback function for the upload progress change event. |
Parameters
OffHeadersReceivedCallback
The callback function for the HTTP Response Header event
(res: CallbackResult) => void
Property |
Type |
res |
CallbackResult |
OffProgressUpdateCallback
The callback function for the upload progress change event.
(res: CallbackResult) => void
Property |
Type |
res |
CallbackResult |
OnHeadersReceivedCallback
The callback function for the HTTP Response Header event.
(result: OnHeadersReceivedCallbackResult) => void
Property |
Type |
result |
OnHeadersReceivedCallbackResult |
OnProgressUpdateCallback
The callback function for the upload progress change event.
(result: OnProgressUpdateCallbackResult) => void
Property |
Type |
result |
OnProgressUpdateCallbackResult |
OnHeadersReceivedCallbackResult
Property |
Type |
Description |
header |
Record<string, any> |
HTTP Response Header returned by the developer server |
OnProgressUpdateCallbackResult
Property |
Type |
Description |
progress |
number |
Upload progress percentage |
totalBytesExpectedToSend |
number |
The length of data expected to be uploaded, in bytes |
totalBytesSent |
number |
The length of uploaded data, in bytes |
API Support
API |
WeChat Mini-Program |
H5 |
React Native |
UploadTask.abort |
✔️ |
|
|
UploadTask.offHeadersReceived |
✔️ |
|
|
UploadTask.offProgressUpdate |
✔️ |
|
|
UploadTask.onHeadersReceived |
✔️ |
|
|
UploadTask.onProgressUpdate |
✔️ |
|
|