list_parts ( $bucket, $filename, $upload_id, $opt )

Lists the completed parts of an in-progress multipart upload.

Access

public

Parameters

Parameter

Type

Required

Description

$bucket

string

Required

The name of the bucket to use.

$filename

string

Required

The file name for the object.

$upload_id

string

Required

The upload ID identifying the multipart upload whose parts are being listed. The upload ID is retrieved from a call to initiate_multipart_upload().

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • max-parts - integer - Optional - The maximum number of parts to return in the response body.
  • part-number-marker - string - Optional - Restricts the response to contain results that only occur numerically after the value of the part-number-marker.
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

List all of the completed parts of a multipart upload.

// Instantiate the class
$s3 = new AmazonS3();
$bucket = 'my-bucket' . strtolower($s3->key);

$response = $s3->list_parts($bucket, 'movie.mp4', 'f_JM_zwhU37pj1tS.F2BXVWUJtGcNso1WEikZImjrBCYUbUQwNnOUwX.Z00O1QmKQXAjqQBD4BVZRGmEXAMPLE--', array(
	'max-parts' => 10
));

// Success?
var_dump($response->isOK());
Result:
bool(true)

Source

Method defined in services/s3.class.php | Toggle source view (22 lines) | View on GitHub

public function list_parts($bucket, $filename, $upload_id, $opt = null)
{
    if (!$opt) $opt = array();

    // Add this to our request
    $opt['verb'] = 'GET';
    $opt['resource'] = $filename;
    $opt['uploadId'] = $upload_id;
    $opt['query_string'] = array();

    foreach (array('max-parts', 'part-number-marker') as $param)
    {
        if (isset($opt[$param]))
        {
            $opt['query_string'][$param] = $opt[$param];
            unset($opt[$param]);
        }
    }

    // Authenticate to S3
    return $this->authenticate($bucket, $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback