• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (PHP SDK)
  4. Objects-Related APIs
  5. Initiate Multipart Upload

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

Pre-defined access policy. Possible values are:

  • ObsClient::AclPrivate
  • ObsClient::AclPublicRead
  • ObsClient::AclPublicReadWrite
  • ObsClient::AclAuthenticatedRead
  • ObsClient::AclBucketOwnerRead
  • ObsClient::AclBucketOwnerFullControl

StorageClass

string

Optional

Storage class of the object. Possible values are:

  • ObsClient::StorageClassStandard
  • ObsClient::StorageClassWarm
  • ObsClient::StorageClassCold

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

SseKms

string

Optional

Algorithm used in SSE-KMS encryption. The value can be:

  • aws:kms

SseKmsKey

string

Optional

Master key used in SSE-KMS encryption. The value can be null.

SseC

string

Optional

Algorithm used in SSE-C encryption. The value can be:

  • AES256

SseCKey

string

Optional

Key used in SSE-C encryption. It is calculated by using AES-256.

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

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->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 () );
}