Search code examples
phplaravellaravel-storage

Showing data after data stored inside storage


Im using

php artisan storage:link

I already store my data in "public/storage/project" using

$ft->store('project');

But when i try to show it, or put it on link, the image did not show up or the link display wrong page.

<p><span>Lokasi File : </span><span><a href="{{ asset('storage/project/'.$row->file_name_att) }}">asdsad</a></span></p>

Or

<p><span>Lokasi File : </span><span><img src="{{ asset('storage/project/'.$row->file_name_att) }}"></span></p>

Solution

  • Currently, you aren't storing the file in public disk. You need to do:

    $ft->store('project', ['disk' => 'public']);
    

    This way, the file will be stored in the public disk and will be available for you via asset() helper.