You can call this operation to upload data in parts based on a specified object name and upload ID after initializing a multipart upload task.
- Before calling UploadPart to upload a part, you must call InitiateMultipartUpload to obtain an upload ID issued by the OSS server. The upload ID uniquely identifies which object the uploaded part belongs to.
- Each part has a part number that identifies the part. Part numbers can range from 1 to 10000. The size of each part ranges from 100 KB to 5 GB in size. In multipart upload mode, each part except the last part must be greater than 100 KB in size. The size of each part is not verified when you call UploadPart because not all parts are uploaded and the system does not know which part is the last part. The size of each part is verified only when you call CompleteMultipartUpload.
- If you use the same part number to upload new data, OSS overwrites the existing data identified by this part number.
- OSS includes the MD5 value of the part received by the server in the ETag header and returns the ETag header to the user.
- If the x-oss-server-side-encryption request header is specified when you call InitiateMultipartUpload, the uploaded part is encoded. The x-oss-server-side-encryption header is included in the response header of UploadPart, indicating the server-side encryption method of the part. For more information, see InitiateMultipartUpload.
PUT /ObjectName?partNumber=PartNumber&uploadId=UploadId HTTP/1.1 Host: BucketName.oss-cn-hangzhou.aliyuncs.com Date: GMT Date Content-Length: Size Authorization: SignatureValue
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 qn6qrrqxo2oawuk53otfjbyc:J/lICfXEvPmmSW86bBAfMmUm**** [6291456 bytes data]
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
|Error code||HTTP status code||Description|
|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 and the MD5 value calculated by OSS are different. To make sure that no errors occur during data transmission over the network, you can include the Content-MD5 value in the request. OSS calculates the MD5 value of the uploaded data and compares it with the Content-MD5 value.|