save image in public folder instead storage laravel 5 save image in public folder instead storage laravel 5 laravel laravel

save image in public folder instead storage laravel 5


In config/filesystems.php, you could do this...change the root element in public

'disks' => [   'public' => [       'driver' => 'local',       'root'   => public_path() . '/uploads',       'url' => env('APP_URL').'/public',       'visibility' => 'public',    ]]

and you can access it by

Storage::disk('public')->put('filename', $file_content);


You can pass disk option to method of \Illuminate\Http\UploadedFile class:

$file = request()->file('image');$file->store('toPath', ['disk' => 'public']);

or you can create new Filesystem disk and you can save it to that disk.

You can create a new storage disc in config/filesystems.php:

'my_files' => [    'driver' => 'local',    'root'   => public_path() . '/myfiles',],

in controller:

$file = request()->file('image');$file->store('toPath', ['disk' => 'my_files']);


You'll need to link your storage directory to your public folder with:

php artisan storage:link

Once you've done that, to display it in the view you can do:

{{ asset('storage/file.txt') }}

Or in your case:

<img src="{{ asset('storage/app/' . $patch) }}">