-
API Reference
- Overview
- Initialization
- Predefined Constants
-
Bucket-Related APIs
- PUT Bucket
- GET Buckets
- HEAD Bucket
- DELETE Bucket
- GET Objects
- GET Object versions
- List Multipart uploads
- Obtain Bucket Metadata
- GET Bucket location
- GET Bucket storageinfo
- PUT Bucket quota
- GET Bucket quota
- Set Bucket storagePolicy
- GET Bucket storagePolicy
- PUT Bucket acl
- GET Bucket acl
- PUT Bucket logging
- GET Bucket logging
- PUT Bucket policy
- GET Bucket policy
- DELETE Bucket policy
- PUT Bucket lifecycle
- GET Bucket lifecycle
- DELETE Bucket lifecycle
- PUT Bucket website
- GET Bucket website
- DELETE Bucket website
- PUT Bucket versioning
- GET Bucket versioning
- PUT Bucket cors
- GET Bucket cors
- DELETE Bucket cors
- PUT Bucket tagging
- GET Bucket tagging
- DELETE Bucket tagging
- Objects-Related APIs
- Other APIs
- Change History
- General Reference
Copied.
PUT Part
API Description
After a multipart upload is initialized, you can use this API to upload a part to a specified bucket by using the multipart upload ID. Except for the part lastly being uploaded whose size ranging from 0 to 5 GB, sizes of the other parts range from 100 KB to 5 GB. The upload part ID ranges from 1 to 10000.
Method Definition
1. ObsClient->uploadPart(array $parameter) 2. ObsClient->uploadPartAsync(array $parameter, callable $callback)
Request Parameter
Field |
Type |
Optional or Mandatory |
Description |
---|---|---|---|
Bucket |
string |
Mandatory |
Bucket name |
Key |
string |
Mandatory |
Object name |
PartNumber |
integer |
Mandatory |
Part number, which ranges from 1 to 10000 |
UploadId |
string |
Mandatory |
Multipart upload ID |
ContentMD5 |
string |
Optional |
Base64-encoded MD5 value of the part to be uploaded. It is provided for the OBS server to verify data integrity. |
Body |
string or resource or GuzzleHttp\Psr7\StreamInterface |
Optional |
Part content to be uploaded |
SourceFile |
string |
Optional |
Path to the source file of the part |
Offset |
integer |
Optional |
Start offset (in bytes) of a part in the source file. The default value is 0. |
PartSize |
integer |
Optional |
Size (in bytes) of a part in the source file. The default value is the file size minus Offset. Except for the part lastly being uploaded whose size ranging from 0 to 5 GB, sizes of the other parts range from 100 KB to 5 GB. |
SseC |
string |
Optional |
Algorithm used in SSE-C encryption. The value can be:
|
SseCKey |
string |
Optional |
Key used in SSE-C encryption. It is calculated by using AES-256. |
- Body and SourceFile cannot be used together.
- If both Body and SourceFile are null, the size of the object to be uploaded is 0 bytes.
- Offset, PartSize, and SourceFile are used together to specify a part of the source file to be uploaded.
Returned Result
Field |
Type |
Description |
---|---|---|
HttpStatusCode |
integer |
HTTP status code |
Reason |
string |
Reason description |
RequestId |
string |
Request ID returned by the OBS server |
ETag |
string |
ETag of the uploaded part |
SseKms |
string |
Algorithm used in SSE-KMS encryption |
SseKmsKey |
string |
Key used in SSE-KMS encryption |
SseC |
string |
Algorithm used in SSE-C encryption |
SseCKeyMd5 |
string |
MD5 value of the key used in SSE-C encryption |
Sample Code
try { $resp = $obsClient->uploadPart( [ 'Bucket' => 'bucketname', 'Key' => 'objectkey', 'UploadId' => 'uploadid', 'PartNumber' => 1, 'Body' => 'Hello OBS' ] ); printf ( "RequestId:%s\n", $resp ['RequestId'] ); printf ( "ETag:%s\n", $resp ['ETag'] ); } catch ( Obs\Common\ObsException $obsException ) { printf ( "ExceptionCode:%s\n", $obsException->getExceptionCode () ); printf ( "ExceptionMessage:%s\n", $obsException->getExceptionMessage () ); }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot