Initiate Multipart Upload
API Description
You can use this API to initialize a multipart upload in a specified bucket.
Method Definition
1. ObsClient->initiateMultipartUpload(array $parameter) 2. ObsClient->initiateMultipartUploadAsync(array $parameter, callable $callback)
Request Parameter
|
Field |
Type |
Optional or Mandatory |
Description |
|---|---|---|---|
|
Bucket |
string |
Mandatory |
Bucket name |
|
Key |
string |
Mandatory |
Object name |
|
ACL |
string |
Optional |
|
|
StorageClass |
string |
Optional |
Storage class of the object |
|
Metadata |
associative array |
Optional |
Customized metadata of the object |
|
WebsiteRedirectLocation |
string |
Optional |
Location where the object is redirected to, when the bucket is configured with website hosting. |
|
ContentType |
string |
Optional |
MIME type of the object. For details about the common content types, see Configuring, Editing, and Viewing Object Metadata. |
|
SseKms |
string |
Optional |
Algorithm used in SSE-KMS encryption. The value can be:
|
|
SseKmsKey |
string |
Optional |
ID of the KMS master key used in SSE-KMS encryption. If this parameter is left blank, the default key is used. To obtain the key ID, see Viewing a Key. |
|
SseC |
string |
Optional |
Algorithm used in SSE-C encryption. The value can be:
|
|
SseCKey |
string |
Optional |
Custom key used in SSE-C encryption. The value is a Base64-encoded 256-bit key. |
Returned Result
|
Field |
Type |
Description |
|---|---|---|
|
HttpStatusCode |
integer |
HTTP status code |
|
Reason |
string |
Reason description |
|
RequestId |
string |
Request ID returned by the OBS server |
|
Bucket |
string |
Name of the bucket involved in the multipart upload |
|
Key |
string |
Name of the object to be uploaded |
|
UploadId |
string |
Multipart upload ID |
|
SseKms |
string |
Algorithm used in SSE-KMS encryption |
|
SseKmsKey |
string |
ID of the KMS master key used in SSE-KMS encryption. If this parameter is left blank, the default key is used. To obtain the key ID, see Viewing a Key. |
|
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->initiateMultipartUpload( [
'Bucket' => 'bucketname',
'Key' => 'objectkey',
'ContentType' => 'text/plain'
] );
printf ( "RequestId:%s\n", $resp ['RequestId'] );
printf ( "Bucket:%s\n", $resp ['Bucket'] );
printf ( "Key:%s\n", $resp ['Key'] );
printf ( "UploadId:%s\n", $resp ['UploadId'] );
} 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