I'm new to Laravel and was wondering if someone can help me out with a simple image upload.
I have a form that allows a user to create a profile and upload and avatar for their profile during the process. This all works perfectly. Here is the code from my controller:
if (request()->hasFile('avatar')) {
$file = request()->file('avatar');
$file->storeAs('avatars/' . auth()->id(), 'avatar.jpg');
}
The image is saved within storage/app/avatars/USER-ID/avatar.jpg
I'm not sure how to display the image from this folder. I've looked for solutions but I am unable to use php artisan storage:link
as it is not my server. How do I go about this without using the storage link? Can I create a link manually?
If someone could explain a solution to me that would be perfect!
Just ask if you need any code snippets.
Thanks!
via cheesycoder