Skip to content
Advertisement

Upload image in Laravel

I try these code in controller:

JavaScript

My Html input file:

JavaScript

but i can’t upload. Any idea?

Advertisement

Answer

you can use storage::putFile('folder_name', $request->image) this will return automatic generated filename and you can store that in your database.

And make sure your have your default file system set to public and your form has this enctype="multipart/form-data"

Reference https://laravel.com/docs/5.5/filesystem#storing-files

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement