babbaggeii
babbaggeii

Reputation: 7737

NotFoundHttpException when trying to access image

I'm trying to load an image from:

<img ng-src="uploads/media/image.png" src="uploads/media/image.png">

But I get the above error, as there is no route set in routes.php. How do I tell laravel just to deliver the asset rather than try to route it?

Edit: additionally, if I visit /uploads, I get the error:

The requested resource /uploads was not found on this server.

All other assets (js/css/img) are working fine. What's different about the uploads directory?

Upvotes: 1

Views: 1426

Answers (2)

Emiel
Emiel

Reputation: 11

I know this topic is from more than one year ago but I ran into a similar problem and got here. I finally got it to work for me by changing the .htaccess file;

In your case you may add the following line before any other rewrite rule in your .htaccess:

RewriteRule ^(uploads) - [L]

Hope this helps.

Upvotes: 1

rmobis
rmobis

Reputation: 26992

Just make sure the asset exists under the public folder. So, if you use your src attribute as uploads/media/image.png, make sure the image is located on public/uploads/media/image.png.

Upvotes: 1

Related Questions