Configure Spatie Media Library plugin to upload to Digital Ocean
Ok, I installed the plugin, all good. Then, I created a DO Spaces bucket, add the CORS config, then in Laravel installed the required packages, added the disk with the name 'digitalocean', and it worked good. When I do a simple
Storage::put('file.txt', 'Contents of the file');
in Tinker to test, it actually creates a file in DO Spaces. All good here.
However, when I use the field, and try to add images, those images are saved correctly, except that they go to the public disk. I already change the FILESYSTEM_DISK variable in .env to 'digitalocean' and already change the config in filesystems.php like this
'default' => env('FILESYSTEM_DISK', 'digitalocean'),
I also made sure to publish the media-library.php config, and change the disk_name to this
'disk_name' => 'digitalocean',
Actually, the livewire part of the field performs a temporary file upload, and if I specify the 'digitalocean' disk in the livewire.php config file, it actually works.
So, when I save the file, why is Media Library still sending the files to the public disk? Is there any other config that I need to change?3 Replies