Hello everyone. After upload file to S3 all files is private by default.
So when i use getUrl() and go to this url i get this from amazon:

So my question is, how can i configure when uploading to upload file as public ?
This is permissions of my bucket:
.
If i will setup in bucket policies that GetObject is by default for all, then this will make no sense:
$temporaryS3Url = $mediaItems[0]->getTemporaryUrl(Carbon::now()->addMinutes(5));
P.S. if i manually make file public - then it's shown.
I have exactly the same problem
I now see in fact that this is already solved earlier:
https://github.com/spatie/laravel-medialibrary/issues/241
you either add 'ACL' => 'public-read' to your config file, or Adjust the Bucket Policy it self having from s3 console manager.
Something similar to this:
{
"Version": "2012-10-17",
"Id": "PolicyId",
"Statement": [
{
"Sid": "SomeValidId",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"s3:GetObject",
"s3:GetObjectAcl"
],
"Resource": "arn:aws:s3:::bucketName/*"
}
]
}
Most helpful comment
you either add
'ACL' => 'public-read'to your config file, or Adjust the Bucket Policy it self having from s3 console manager.Something similar to this: