Reputation: 1379
I am trying to upload large file upto 300 MB, but every time I am getting "Internal Server Error". I am using:
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();
}
What should I do?
Upvotes: 1
Views: 565
Reputation: 25721
Trying to upload a 300MB file in one go is a bad idea.
You could use the setMultipartUploadSize method to have the S3Client split it into chunks. However it would also be even simpler just to use the putObject() method which takes care of that for you.
Upvotes: 1