Search code examples
laravellaravel-7laravel-storagelaravel-filesystem

Laravel file from storage not found


Filesystem settings

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

Upload file

 $path = $request->file('file-upload-photo-profile')->store('public/profile');

        $user->photo_profile_url =  Storage::url($path);

Patch to folder with file:

storage/app/public/profile

Example url:

Try get image:

   <img src="{{asset( $user->photo_profile_url)}}" > 

Generated url: http://sakura/storage/profile/aDtjR6z7Ih4fkmo7bdAqqyDXmhu2qE4pg3s5BBla.jpg

But I got 404 for this image. In server settings root dirrectory

public

How do I get a link to an image?


Solution

  • Do you have the symlink to the storage folder in your app/public directory?

    Like so: php artisan storage:link