thewebartisan7's avatar

Avoid that Storage save file in local cloud

I am using below code for store photo.

I keep default configuration of laravel, so public and local are:


        'local' => [
            'driver' => 'local',
            'root'   => storage_path('app'),
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

default is "local" and cloud is "local"

So it's all as default configuration.

When I am trying to save a file in public directory like:


       $file->storeAs('photos', 'image.png', 'public')

Then file is stored correctly in storage/app/public/photos/image.png

But it's also stored in storage/app/ with generated filename.

How to avoid this?

If I try to disable "cloud" => "local" by removing then there is an error.

But seem that this "cloud" cause the double upload of image.

0 likes
0 replies

Please or to participate in this conversation.