Spatie media digital ocean spaces, folders
Hi I have got DO spaces working well with filament, the only issues is its only uploading to random folders with numbers, i set a directory but its not working, hope you can help, thanks
Solution:Jump to solution
So that would usually be set with:
'root' => env('DO_DIRECTORY', 'local/images'),...
12 Replies
This isn't random this is intentional. This is Spatie Media for you and how it works.
The number is the reference to the database record and you should have a bucket soley for spatie media.
I have created several s3 drivers with different folders when I want to group by folder
Thanks for the reply, yes i understand that Spatie puts it in folders like that but I want these folders in a directory on DO, so 33 and 34 will be in a directory called local/images, but they are not in a directory at all, and I cant get it to work, can you shed some light? Thanks
Because you need to set the directory there in the driver usually
I have in the driver 'directory_env' => env('DO_DIRECTORY'),
Solution
So that would usually be set with:
'root' => env('DO_DIRECTORY', 'local/images'),
Ah, I will try it that way direct in the driver
Can I ask why you are setting default here? 'DO_DIRECTORY', 'local/images I thought the code I did will work as well, thanks
Incase one hasn’t been defined it makes sense to set a default
Sorry if I am getting cofused but wont 'root' => be the same as setting 'directory_env' =>
Last time I checked directory_env didn’t work in S3 driver type and requires root
Wow, you are probably right, I was following this tutorial and adding custom code to s3 driver worked for him, so strange
https://youtu.be/jW3qjVTQl6Y?si=u7-PqRNbT1DL5epf&t=956
I skipped to the part he adds the custom code. Will try root now
Code With Dary
YouTube
How to Use DigitalOcean Spaces in Laravel & FilamentPHP | How to Us...
In this tutorial, we dive into how to use DigitalOcean Spaces to store and manage files from your Filament application. We'll start by understanding what DigitalOcean Spaces is and why it's a valuable addition to your storage solutions. From there, we'll guide you through setting up a connection between DigitalOcean Spaces and a Laravel applicat...
sorry starts at 15:45
adding root. works!!!
how did it work for him lol
Thanks for your help, do you know why it worked for him?
I’m not sure it did tbh…
But it could be how we handle the upload I’m not too sure