S3 fileupload with ACL public-read access #11486
Replies: 1 comment 3 replies
-
I'm not 100% sure this is the same issue, but I will leave this here in case others are running into an issue where S3 Uploads are simply not working using the default By default livewire attempts to use S3 ACL if you set to public If you set visiblity to The good news is there is a bit of a dirty hack workaound: setting this to neither public nor private allows you to treat uploads as public, but without trying to force file-specific ACL - instead relying on your bucket policy (to allow This is pretty much what I'm always after so in my Filament projects that use S3 I create my own use Closure;
use Filament\Forms\Components\FileUpload as BaseFileUpload;
class FileUpload extends BaseFileUpload
{
/**
* By default livewire attempts to use S3 ACL if you set to public visibility. This
* will throw an error unless your S3 bucket is configured to use ACLs - something
* that S3 recommends against as the default. If you set visiblity to private,
* livewire will use temporaryUrls for reading images. Setting this to neither
* public or private allows you to treat uploads as public, but without trying
* to force file-specific ACL - instead relying on your bucket policy (to allow
* s3:GetObject)
*/
protected string|Closure $visibility = 'bucket-defaults';
}
If I use that component in place of the Filament |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Package
Form builder
Package Version
v3.2.34
How can we help you?
When it uploads to S3, the file is being created as private. I want it to be a public file just like making it in the AWS panel with the option "make public using ACL." When using Laravel's filesystem (in a controller using putFileAs), it uploads public-read access properly, but in filament, it is uploaded as private, and I need to go and make it public using the "make public using ACL" button.
here is the conf.
Any idea how to make it work?
Beta Was this translation helpful? Give feedback.
All reactions