amazon web services - How to set ACL to public-read on AWS-SDK-PHP v3.2 using transfer manager -


ok, first question, nice.

i having problems finding answer question. yes ive tried options transfer constructor don't mention acl options. searches on google come either blank or version 2.x code

$options[] = [ 'debug' => true, ]; // files transferred $dest = 's3://newbucket/'.$uuid; // create transfer object. $manager = new \aws\s3\transfer($s3, $path, $dest, $options ); // perform transfer synchronously. $manager->transfer(); $promise = $manager->promise(); $promise->then(function () {     echo 'done!'; }); 

everything uploads ok files not public-read where/how set public-read on files uploaded in version 3.2

you can add 'before' closure array of options you're passing transfer manager handle assigning permissions. try replacing manager instantiation code 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';         }     }, ]); 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -