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

示例#1
0
文件: S3.php 项目: Webiny/Framework
 /**
  * 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);
 }