我正在尝试将大文件上传到300 MB,但每次我都会收到“内部服务器错误”。我正在使用:
try {
$uploader = UploadBuilder::newInstance()
->setClient($s3Client)
->setSource($fileloc)
->setBucket($buketname)
->setKey($filename)
->setConcurrency(3)
->setOption('ACL', $fileacl)
->setOption('Metadata', array('Agent' => 'aisS3Client'))
->setOption('CacheControl', 'max-age=3600')
->build();
// Perform the upload. Abort the upload if something goes wrong
try {
$uploader->upload();
//echo "File Uploaded : ".$filename;
} catch (MultipartUploadException $e) {
$uploader->abort();
//echo "File Did not Uploaded : ".$filename;
}
} catch (\Aws\S3\Exception\S3Exception $e) {
echo $e->getMessage();
}
我该怎么办?
答案 0 :(得分:1)
尝试一次上传300MB文件是个坏主意。
您可以使用setMultipartUploadSize方法让S3Client将其拆分为块。但是,使用putObject()方法来处理它也会更简单。