I have been able to upload files to my bucket using the below code from the AWS PHP SDK. The problem is when I try to upload files that are larger than 15 mb, the script throws an error. Otherwise it works as expected. Any Ideas what I'm doing wrong? Thanks in advance.
require $dir . 'aws/aws-autoloader.php';
$s3Client = new Aws\S3\S3Client(array(
'version' => 'latest',
'region' => 'us-west-2',
'credentials' => array(
'key' => 'KEY',
'secret' => 'SECRET',
)
));
$result = $s3Client->putObject(array(
'Bucket' => 'eot-resources',
'Key' => $org_id."_".$_FILES["fileToUpload"]["name"],
'SourceFile' => $_FILES["fileToUpload"]["tmp_name"],
'Body' => new GuzzleHttp\Psr7\Stream(fopen($_FILES["fileToUpload"]["tmp_name"], 'r')),
'ACL' => 'public-read',
'StorageClass' => 'REDUCED_REDUNDANCY',
'Metadata' => array(
'Foo' => 'abc',
'Baz' => '123'
)
));
echo "URL: ".$result['ObjectURL'] . "<br>";
I get the following error when trying to upload a large file bigger than 15mb. Other than that it works.
Warning: fopen(): Filename cannot be empty in /Users/xxx/Code/xxx/wp-content/plugins/xxx/parts/part-upload_file.php on line 37.
Line 37 reads..
'Body' => new GuzzleHttp\Psr7\Stream(fopen($_FILES["fileToUpload"]["tmp_name"], 'r')),
Any help/advice/tips would be appreciated.