Initiates a multipart upload and returns an UploadId
.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The name of the bucket to use. |
|
|
Required |
The file name for the object. |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Initiate a new multipart upload.
- Initiate a new multipart upload using
initiate_multipart_upload()
. - Upload the parts using
upload_part()
. - Complete the upload using
complete_multipart_upload()
.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket' . strtolower($s3->key); // Initiate a new multipart upload $response = $s3->initiate_multipart_upload($bucket, 'movie.mp4', array( 'contentType' => 'video/mp4', 'acl' => AmazonS3::ACL_PUBLIC, 'storage' => AmazonS3::STORAGE_STANDARD, 'meta' => array( 'resolution' => '720p', 'rating' => 'US PG-13', 'runtime' => '2:04:37' ) )); // Get the Upload ID $upload_id = (string) $response->body->UploadId; // Success? var_dump($response->isOK());Result:
bool(true)
Related Methods
See Also
Source
Method defined in services/s3.class.php | Toggle source view (64 lines) | View on GitHub