You need to pass second argument as public.
$this->photo->store('avatars','public');
For more info you can check laravel docs https://laravel.com/docs/10.x/filesystem#specifying-a-disk
I have this page that uploads the user's avatar to the the app. I'm using Livewire 3, so it should be simple.
// validation
$user->avatar = $this->photo->store('avatars');
$user->save();
Now, this works, but instead of storing the file in /storage/app/public/avatar it uploads it to /storage/app/avatar so I can't see the files in the browser. Field in the database has the hash and file extension, so it's working, and if I go directly to the directory, of course they're there.
This won't work:
<img src="/storage/{{ Auth::user()->avatar }}">
neither
<img src="{{ asset('/storage/') . Auth::user()->avatar }}">
But if I manually move the /avatar directory inside /storage/app/public, it works.
This must be a configuration issue for sure, but I don't know what. I don't find it in the Laravel documentation or Livewire's, it should be working like magic, but it's not.
Thanks!
You need to pass second argument as public.
$this->photo->store('avatars','public');
For more info you can check laravel docs https://laravel.com/docs/10.x/filesystem#specifying-a-disk
Please or to participate in this conversation.