Webiny\Component\Amazon\Bridge\S3\S3::multipartUpload PHP Method

multipartUpload() public method

In case of large files, use the multipartUpload method, so the file is sent in chunks to S3, without the need to read the complete file in memory.
public multipartUpload ( $bucket, $key, $sourcePath, integer $concurrency = 1 ) : mixed
$bucket
$key
$sourcePath
$concurrency integer
return mixed
    public function multipartUpload($bucket, $key, $sourcePath, $concurrency = 1)
    {
        $uploader = new MultipartUploader($this->instance, $sourcePath, ['bucket' => $bucket, 'key' => $key]);
        try {
            $uploader->upload();
            return true;
        } catch (MultipartUploadException $e) {
            return false;
        }
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * In case of large files, use the multipartUpload method, so the file is sent in chunks to S3, without the need
  * to read the complete file in memory.
  *
  * @param     $bucket
  * @param     $key
  * @param     $sourcePath
  * @param int $concurrency
  *
  * @return mixed
  */
 public function multipartUpload($bucket, $key, $sourcePath, $concurrency = 1)
 {
     return $this->instance->multipartUpload($bucket, $key, $sourcePath, $concurrency);
 }