Uploads data by part based on the specified object name and upload ID after you initiate a multipart upload operation.

Usage notes

  • Before you call UploadPart to upload data by part, you must call the InitiateMultipartUpload operation to obtain an upload ID generated by Object Storage Service (OSS).
  • If you use the same partNumber to upload a new part, the existing part that is uploaded by using the partNumber is overwritten.
  • OSS includes the MD5 hash of each received part in the ETag header of the response.
  • If the x-oss-server-side-encryption request header is specified when you call InitiateMultipartUpload, the uploaded part is encrypted. The x-oss-server-side-encryption header is included in the response, which indicates the server-side encryption algorithm of the part. For more information, see InitiateMultipartUpload.

Request syntax

PUT /ObjectName?partNumber=PartNumber&uploadId=UploadId HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Content-Length: Size
Authorization: SignatureValue

Request elements

Element Type Required Description
partNumber Positive integer Yes The number that identifies a part.

Valid values: 1 to 10000.

The size of a part ranges from 100 KB to 5 GB.
Note In multipart upload, each part except the last part must be larger than or equal to 100 KB in size. The size of each part is not verified when you call UploadPart because not all parts have been uploaded and OSS does not know which part is the last part. The size of each part is verified only when you call CompleteMultipartUpload.
uploadId String Yes The ID that identifies the object to which the parts to upload belong.

Examples

Sample requests

PUT /multipart.data?partNumber=1&uploadId=0004B9895DBBB6EC98E36  HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Content-Length: 6291456
Date: Wed, 22 Feb 2012 08:32:21 GMT
Authorization: OSS qn6qrrqxo2oawuk53otf****:J/lICfXEvPmmSW86bBAfMmUm****
[6291456 bytes data]

Sample responses

HTTP/1.1 200 OK
Server: AliyunOSS
Connection: keep-alive
ETag: "7265F4D211B56873A381D321F586****"
x-oss-request-id: 3e6aba62-1eae-d246-6118-8ff42cd0****
Date: Wed, 22 Feb 2012 08:32:21 GMT

SDK

You can use OSS SDKs for the following programming languages to call the UploadPart operation:

Error codes

Error code HTTP status code Description
NoSuchUpload 404 The error message returned because the specified multipart upload ID does not exist.
InvalidArgument 400 The error message returned because the part number is not within the range of 1 to 10000.
InvalidDigest 400 The error message returned because the Content-MD5 value in the request is inconsistent with the MD5 hash calculated by OSS. To make sure that errors do not occur during data transmission over the network, you can include the Content-MD5 value in the request. OSS calculates the MD5 hash of the uploaded data and verifies whether the MD5 hash is consistent with the Content-MD5 value.