Uploads a part to a specified object by using the upload ID returned by InitiateMultipartUpload.
Usage notes
-
Before you call UploadPart, you must call InitiateMultipartUpload to obtain an upload ID from OSS.
-
If you upload a new part with the same partNumber, the existing part is overwritten.
-
OSS includes the MD5 hash of each received part in the ETag header of the response.
-
If you specify the x-oss-server-side-encryption header in InitiateMultipartUpload, each uploaded part is encrypted. The response includes the x-oss-server-side-encryption header indicating the encryption algorithm. For more information, see InitiateMultipartUpload.
Permissions
By default, an Alibaba Cloud account has full permissions. RAM users or RAM roles under an Alibaba Cloud account do not have any permissions by default. The Alibaba Cloud account or account administrator must grant operation permissions through RAM policies or Bucket Policy.
|
API |
Action |
Description |
|
UploadPart |
|
Uploads parts. |
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 headers
All headers in an UploadPart request are common request headers. For more information, see Common request headers.
Request elements
|
Element |
Type |
Required |
Example |
Description |
|
partNumber |
Positive integer |
Yes |
1 |
The part number. Valid values: 1 to 10000. The size of a part ranges from 100 KB to 5 GB. Note
Each part except the last must be at least 100 KB. Part sizes are not verified during UploadPart because OSS cannot determine which part is last. Size verification occurs when you call CompleteMultipartUpload. |
|
uploadId |
String |
Yes |
0004B9895DBBB6EC9**** |
The ID that identifies the object to which the parts to upload belong. |
Response headers
|
Header |
Type |
Example |
Description |
|
Content-MD5 |
String |
1B2M2Y8AsgTpgAmY7PhC**** |
The MD5 hash of the part. Important
The MD5 hash of the part is obtained after the client uploads the object. It is not the MD5 hash in the response body. |
|
x-oss-hash-crc64ecma |
String |
316181249502703**** |
The CRC-64 value of the part. |
The response also includes common headers such as Date and x-oss-request-id. Common HTTP headers.
Examples
Sample request
PUT /multipart.data?partNumber=1&uploadId=0004B9895DBBB6EC9**** HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Content-Length: 6291456
Date: Wed, 22 Feb 2012 08:32:21 GMT
Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,AdditionalHeaders=content-length,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
[6291456 bytes data]
Sample response
HTTP/1.1 200 OK
Server: AliyunOSS
Content-length: 0
Connection: keep-alive
ETag: "7265F4D211B56873A381D321F586****"
x-oss-request-id: 3e6aba62-1eae-d246-6118-8ff42cd0****
Date: Wed, 22 Feb 2012 08:32:21 GMT
Content-MD5: 1B2M2Y8AsgTpgAmY7Ph****
x-oss-hash-crc64ecma: 316181249502703****
x-oss-server-time: 77
OSS SDKs
ossutil
For information about the ossutil command that corresponds to the UploadPart operation, see upload-part.
Error codes
|
Error code |
HTTP status code |
Description |
|
NoSuchUpload |
404 |
The specified multipart upload ID does not exist. |
|
InvalidArgument |
400 |
The part number is not within the range of 1 to 10000. |
|
InvalidDigest |
400 |
The Content-MD5 value in the request does not match the MD5 hash calculated by OSS. To prevent transmission errors, you can include Content-MD5 in the request. OSS calculates the MD5 hash of the uploaded data and compares it with the Content-MD5 value. A mismatch indicates a data transmission error. |