Red-AB's avatar

How to define a root for S3 storage ?

Hi everybody,

I am using Laravel 5.5 with a S3 cloud storage. In filesystems.php I have called my custom disk uploads with those settings :

'uploads' => [
    'driver' => 's3',
    'root'   => 'public/uploads'
]

The file upload works great, however when I do this :

Storage::disk('uploads')->put('file.txt', 'My content');

Then the root key is never considered and my file is always uploaded to the root of my bucket. Is there any way to solve this rather than specifying the full path of the file as a parameter ? Thanks !

0 likes
1 reply
Red-AB's avatar
Red-AB
OP
Best Answer
Level 1

Hi,

After some investigation, the problem came from my old cached config file. For some strange reasons, the Artisan config:clear command doesn't work properly on my environment.

So the fix is to run a php artisan config:cache, which will recreate the cached config file in boostrap/cache/config.php. If the problem remains, delete the config.php manually and run the Artisan command again to make sure that your cache file is updated.

1 like

Please or to participate in this conversation.