Updated on 2024-04-15 GMT+08:00

Uploading Parts

Functions

After initiating a multipart upload, you can use this operation to upload parts for the multipart upload using its task ID. When parts are uploaded in a multipart upload of an object, the upload sequence does not affect part merging, namely, multiple parts can be uploaded concurrently.

Part sizes range from 100 KB to 5 GB. However, when parts are being merged, the size of the last uploaded part ranges from 0 to 5 GB. The upload part ID ranges from 1 to 10,000.

The value of partNumber in a multipart task is unique. If you upload a part of the same partNumber repeatedly, the last part uploaded will overwrite the previous one. When multiple concurrent uploading of the same partNumber part of the same object is performed, the Last Write Win policy is applied. The time of Last Write is defined as the time when the metadata of the part is created. To ensure data accuracy, the client must be locked to ensure concurrent upload of the same part of the same object. Concurrent upload of different parts of the same object does not need to be locked.

Request Syntax

PUT /ObjectName?partNumber=partNum&uploadId=uploadID  HTTP/1.1  
Host: bucketname.obs.region.example.com
Date: date
Content-Length: length 
Authorization: authorization
Content-MD5:md5
<object Content>

Request Parameters

This request uses parameters to specify the upload task ID and part number. Table 1 describes the parameters.

Table 1 Request parameters

Parameter

Description

Mandatory

partNumber

Indicates the ID of a part to be uploaded. The value is an integer from 1 to 10000.

Type: integer

Yes

uploadId

Indicates a multipart upload ID.

Type: string

Yes

Request Headers

This request uses common headers. For details, see Table 3.

Request Elements

This request involves no elements.

Response Syntax

1
2
3
4
HTTP/1.1 status_code
Date: date
ETag: etag
Content-Length: length

Response Headers

The response to the request uses common headers. For details, see Table 1.

Response Elements

This response contains no elements.

Error Responses

  1. If a part number is not within the range from 1 to 10000, OBS returns 400 Bad Request.
  2. If a part size has exceeded 5 GB, the error code 400 Bad Request is returned.
  3. If the AK or signature is invalid, OBS returns 403 Forbidden and the error code is AccessDenied.
  4. Check whether the bucket exists. If the bucket is not found, OBS returns 404 Not Found and the error code is NoSuchBucket.
  5. View the bucket ACL to check whether the user has the read permission for the requested bucket. If the user does not have the read permission, OBS returns 403 AccessDenied.
  6. Check whether the multipart upload task exists. If the task does not exist, OBS returns 404 Not Found and the error code is NoSuchUpload.
  7. Check whether the request user is the initiator of the multipart upload task. If not, OBS returns 403 Forbidden and the error code is AccessDenied.

Other errors are included in Table 2.

Sample Request

PUT /object02?partNumber=1&uploadId=00000163D40171ED8DF4050919BD02B8 HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.example.com
Accept: */*
Date: WED, 01 Jul 2015 05:15:55 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:ZB0hFwaHubi1aKHv7dSZjJts40g=
Content-Length: 102015348

[102015348 Byte part content]

Sample Response

1
2
3
4
5
6
7
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: 8DF400000163D40956A703289CA066F1
ETag: "b026324c6904b2a9cb4b88d6d61c81d1"
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCUQu/EOEVSMa04GXVwy0z9WI+BsDKvfh
Date: WED, 01 Jul 2015 05:15:55 GMT
Content-Length: 0