Upload Part

Last updated: 2020-02-28 18:21:52

Description

API Upload Part requests the implementation to upload objects to COS in the way of part. A maximum of 10000 part is supported, each part is 1MB-5GB in size, and the last part can be smaller than 1MB.

Detail analysis

  1. Multipart upload first needs to initialize it and use the Initiate Multipart Upload API to implement it. After initialization, you will get a uploadId that uniquely identifies this upload.
  2. When you request a Upload Part, you need to carry the numbers of partNumber and uploadId,partNumber as blocks, and you can upload them out of order.
  3. When the incoming uploadId and partNumber are the same, the later incoming block will overwrite the previously passed block. A 404 error, NoSuchUpload, is returned when uploadId does not exist.

Request

Request Sample

PUT /<ObjectKey>partNumber=PartNumber&uploadId=UploadId HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Content-Length: Size
Authorization: Auth String

[Object]

For more information on Authorization: Auth String (, please see Request Signature Documentation).

Request header

Public head

The implementation of this request operation uses a common request header. For more information on common request headers, see Common Request Headers Document.

Non-public head

Required header
The request operation requires the request header to use a required header, as shown below:

Name Description Type Required
Content-Length HTTP request content length defined in RFC 2616 (bytes) String Yes

Recommended head
This request operation recommends that the request header be used as the recommended header. The details are as follows:

Name Description Type Required
Expect HTTP request content length defined in RFC 2616 (bytes) String No
Content-MD5 The Base64-encoded MD5 hash value of the request body content defined in RFC 1864, which is used for integrity checking to verify whether the request body has changed during transmission. String No

Request parameter

The details are as follows:

Parameter name Description Type Required
PartNumber Identify the number of multipart upload this time. PartNumber should be greater than or equal to 1. String Yes
UploadId When the ID, that identifies multipart upload uses the Initiate Multipart Upload interface to initialize the multipart upload, it will get a uploadId,. The ID not only uniquely identifies this part data, but also identifies the relative location of the part data in the whole file. String Yes

Request body

The request body of the request is the data content of the part.

Response

Response header

Public response header

The response includes Public response header. For more information on Public response header, please see Common Response Header Document.

Unique response header

The response will probably return the following response header information:

Name Description Type
X-cos-server-side-encryption If server encryption is specified when uploading, the response header will return the response header. Enumerated value: AES256 String
X-cos-storage-class Returns the storage class information of the object. COS returns this response header for all objects except Standard storage class. Enumerated values: STANDARD_IA and ARCHIVE String

Response body

The response body for the request is empty.

Error Codes

There is no special error message for this request operation. For common error messages, see Error Codes Document.

Actual case

Request

PUT /exampleobject?partNumber=1&uploadId=1484727270323ddb949d528c629235314a9ead80f0ba5d993a3d76b460e6a9cceb9633b08e HTTP/1.1
Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
Date: Wed,18 Jan 2017 16:17:03 GMT
Authorization: q-sign-algorithm=sha1&q-ak=AKIDWtTCBYjM5OwLB9CAwA1Qb2ThTSUj****&q-sign-time=1484727403;32557623403&q-key-time=1484727403;32557623403&q-header-list=host&q-url-param-list=partNumber;uploadId&q-signature=bfc54518ca8fc31b3ea287f1ed2a0dd8c8e8****
Content-Length: 10485760

[Object]

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 0
Connection: keep-alive
Date: Wed,18 Jan 2017 16:17:03 GMT
Etag: "e1e5b4965bc7d30880ed6d226f78a5390f1c09fc"
Server: tencent-cos
x-cos-request-id: NTg3ZjI0NzlfOWIxZjRlXzZmNGJfMWYy