MonaMuhr
MonaMuhr

Reputation: 185

dont get the right path in laravel for my uploads folder

i always use this to go to the public folder:

src="{{ asset('img/pic.png') }}">

everything works perfect

but now is it not possible because i want to show the avatar picture and something like this not works

<img src="../../public/uploads/avatars/{{$user->avatar}}">

so ive used this but it doesnt work i dont know how to go to the uploads folder

does anybody know the reason?

thank you!!!

Upvotes: 0

Views: 37

Answers (2)

Polaris
Polaris

Reputation: 1249

If your uploads folder is in the public folder, there is no need to use the asset() helper. You could just use the following:

<img src="/uploads/avatars/{{$user->avatar}}">

Upvotes: 0

thisiskelvin
thisiskelvin

Reputation: 4202

Within the asset() helper, you have missed out the uploads/ folder.

So this should be src="{{ asset('uploads/avatars/' . $user->avatar) }}"

Upvotes: 1

Related Questions