Esempio n. 1
0
 /**
  *
  * @param string $multipart_id
  * @return mixed The Amazon S3 response
  * @throws KeyNotFoundException
  * @throws \S3MultiUpload\Exception	
  */
 public function completeMultipart($multipart_id)
 {
     if (!(list($bucket, $key) = $this->key_storage->get($multipart_id))) {
         throw new KeyNotFoundException('There is no upload in progress for key "' . $multipart_id . '"');
     }
     $parts = $this->listParts(array('Bucket' => $bucket, 'Key' => $key, 'UploadId' => $multipart_id));
     try {
         $response = $this->s3->completeMultipartUpload(array('Bucket' => $bucket, 'Key' => $key, 'UploadId' => $multipart_id, 'Parts' => $parts));
     } catch (\Exception $e) {
         $this->abortMultipartUpload($multipart_id);
         throw $e;
     }
     return $response;
 }
Esempio n. 2
0
 /**
  * completeMultipartUpload
  *
  * @param array $params
  *
  * @return \Guzzle\Service\Resource\Model
  */
 public function completeMultipartUpload(array $params = array())
 {
     $params['Bucket'] = $this->name;
     return $this->client->completeMultipartUpload($params);
 }