I'm trying to upload an image in laravel and I'm using store
method to save it in storage.
$path = $request->file('avatar')->store('public/avatar');
It's working fine and save the file into storage/app/public/avatar/
directory and its path will be somethin like this:
public/avatar/o4C4pTNuot8dDmAjpATPn5ZJWMkbfhdKJGF5PEmw.jpg
And that's ok! but I have a problem with retrieving this image! when I try this address:
domain.local/public/avatar/o4C4pTNuot8dDmAjpATPn5ZJWMkbfhdKJGF5PEmw.jpg
it shows a 404 not found page.
Anyway! I know that, if I change public
to storage
in address, it will show me the image.
Is it normal? I know something is not ok, but I don't know what and why!
p.s: I used php artisan storage:link
and created symlink before, so my address is accessible.