Fileupload to AWS S3
I'm trying to store images on AWS S3. The moment I upload an image it creates a folder
livewire-tmp
(with the image inside) in the bucket in AWS S3 in it. So far so good....However, the moment I press the create button in Filament, it writes it to local disk (and livewire-tmp folder is gone at AWS S3). Despite the below configuration. Am I overlooking something?
.env file
FILESYSTEM_DISK=s3
AWS_ACCESS_KEY_ID=A***A
AWS_SECRET_ACCESS_KEY=f***
AWS_DEFAULT_REGION=eu-central-1
AWS_BUCKET=my-bucket-dev
AWS_URL="https://my-bucket-dev.s3.amazonaws.com/"
AWS_USE_PATH_STYLE_ENDPOINT=true
config/filesystem.php:
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
],
Filament resource
FileUpload::make('photo_featured')
->disk('s3')
->acceptedFileTypes($types = ['jpg', 'jpeg', 'png'])
->image()
->maxSize(15000)
->imageEditor()
->columnSpan('full'),
3 Replies
Did you change this recently? Maybe some OpCache not cleared or similar? Config looks good to me.
Solution
Not 100% but I think
s3
needs ->visibility('private')
🤔Thanks Dennis. I can confirm it was the
->visibility('private')
part