Level 55
Jun 3, 2021
1
Level 4
Spatie media library upload to Amazon s3 bucket subfolder
I am using spatie media library in Laravel with the below code to upload images to s3 bucket
$file = $this->fileUploadModel
->addMediaFromDisk($file->path(), 's3')
->toMediaCollection();
The image is saved to s3 bucket on the format:
- my_bucket_name/1/image_name.png
- my_bucket_name/2/image_name.png etc
However I want a way to store the images inside an images folder ie.
my_bucket_name/images/1/image_name.png
By using only Laravel you can do that with a simple:
$file->store('images','s3');
How can I do that in spatie library?
Please or to participate in this conversation.