search

Home  >  Q&A  >  body text

Laravel image not found in public/storage

<p>I'm trying to access images for my project. </p> <p>I have run php artisan storage link</p> <p>Laravel Create Public/Storage</p> <p>When I upload an image to storage/app, I see the image in storage/app but not in public/storage. </p> <p>When I try to view the image on my browser, I get an error 404</p> <p>controller.php</p> <pre class="brush:php;toolbar:false;">Property::create([ 'SittingRoom'=> request()->file('sittingroom')->store('apartments') ]);</pre> <p>bladeview.php</p> <pre class="brush:php;toolbar:false;"><img src="{{asset('storage/'.$duplex->SittingRoom)}}"></pre> <p>Browser link</p> <pre class="brush:php;toolbar:false;">http://127.0.0.1:8000/storage/apartments/HNLDysVUdRG7ZTBkF2qFGk2B2tAKYzYcVImNEWLx.jpg</pre> <p>After running artisan storage link</p> <p>C:xampphtdocsOPAAM> php artisan storage: link</p> <p>Message [C:xampphtdocsOPAAMpublicstorage] link is connected to [C:xampphtdocsOPAAMstorageapp/public]. </p>
P粉043566314P粉043566314458 days ago583

reply all(1)I'll reply

  • P粉420868294

    P粉4208682942023-08-27 09:49:59

    The problem isconfig/filesystems.php

    'default' => env('FILESYSTEM_DISK', 'public'),

    But in the .env file

    FILESYSTEM_DISK=local

    This configuration will save your images in Storage/app instead of storage/app/public.

    Images saved in storage/app are not publicly accessible. So you have to change the .env file

    reply
    0
  • Cancelreply