alihoushyaripour's avatar

How to upload file or image in public/ directory?

Hi,

I write this code when my laravel version is 5.6 and its work fine and upload files into public/ directory, since I upgrade my laravel to 5.7 this code worked fine but it was uploaded the files into storage/app/ directory, and not in public/

// upload method 1
request()->file("$key")->storeAs('/', $fileName);

// upload method 2
Storage::put('/', request()->file("$key"), 'public');

I search a lot but not found any same problem with my problem.

What should I do?

0 likes
2 replies
alihoushyaripour's avatar
Level 2

I found the solution from this link, it's very useful.

https://quickadminpanel.com/blog/file-upload-in-laravel-the-ultimate-guide/
michael_bt's avatar

Nice i look into the guide. You need to set up. Filesystem default in config.php to public After that just storage link and the function will works like a charm

1 like

Please or to participate in this conversation.