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 . |
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 |
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
