Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

404 Get request in laravel from src file path

Im trying to load an image from my /public/images folder in laravel. Im getting a 404 not found error. I know the image exists, and vscode even autocompletes the path for me.

here is the img tag:

<img src="/public/images/1616327614.jpg" class="im" alt="...">

and the file path:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

file path

I have also tried variations of the img src path, for example:

<img src="./public/images/1616327614.jpg" class="im" alt="...">
<img src="./images/1616327614.jpg" class="im" alt="...">

Any advice here would be greatly appreciated.

>Solution :

Try to do something like this,

<img src="{{asset('images/1616327614.jpg')}}" class="im" alt="...">

Or

<img src="{{public_path('images/1616327614.jpg')}}" class="im" alt="...">

Remember to always check the documentation: https://laravel.com/docs/9.x/helpers#method-public-path

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading