ok, my first SO question, be nice.
I am having problems finding the answer to this question. yes ive tried the options for the transfer constructor don't mention any ACL options. my searches on google come up either blank or for version 2.x this is my code
$options[] = [
'DEBUG' => true,
];
// Where the files will be transferred to
$dest = 's3://newbucket/'.$UUID;
// Create a transfer object.
$manager = new \Aws\S3\Transfer($s3, $path, $dest, $options );
// Perform the transfer synchronously.
$manager->transfer();
$promise = $manager->promise();
$promise->then(function () {
echo 'Done!';
});
everything uploads ok but the files are not public-read where/how do i set Public-read on the files uploaded in VERSION 3.2
You can add a 'before' closure to the array of options you're passing to the transfer manager that could handle assigning permissions. Try replacing your manager instantiation code with this:
$manager = new \Aws\S3\Transfer($s3, $path, $dest, [
'before' => function (\Aws\CommandInterface $command) {
if (in_array($command->getName(), ['PutObject', 'CreateMultipartUpload'])) {
$command['ACL'] = 'public-read';
}
},
]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With