willie.mwewa's avatar

How can i view the image I uploaded to storage/app/images in an img tag(HTML)

I am trying to view the images i uploaded to the storage/app/path

with doing the images does not apear.

Here is how it is saved on the database application_attachments/YE0kf23olBlrwJ0jJXkcylpe2a46Mvcs732ZxfHc.jpeg

Please help me assess the image. Plus i already created a simlink with php artisan.

0 likes
3 replies
Cronix's avatar

The files should be in storage/app/public, with storage/app/public linked to public/storage

So if you upload an image to storage/app/public/application_attachments, the url would just be <img src="/application_attachments/file.jpeg">

willie.mwewa's avatar

Here is how i am uploading the images in my controller

// upload all attachments $files = request('files');

    foreach ($files as $file) {
        $filename = $file->store('application_attachments');
       
        EducationalAttachment::create([
            'user_id' => $user_id,
            'file' => $filename
        ]);
    }

in the terminal i also had to run php artisan storage:link

But in my view i still cant see the image with either

or <img src"{{ asset($file) }}"/>

Please or to participate in this conversation.