How to Retrieving Uploaded Files in Laravel

We used $_FILES[] global variable to get posted file in php. But in laravel it will change, Laravel created Class for Files, which helps to get more details about uploaded file in Laravel.

You can use it with Request Class like this :

photo is name of file field, you can change it.

You can check is file present by:

return true if file present.

Validate the file:

Get File Paths:

Get File Extensions:

Uploaded File:

The $filename is the name of you image or you can assign any new name.

 

 

Was this post helpful?
Let us know if you liked the post. That’s the only way we can improve.
Yes0
No1
Harinder Singh

Harinder Singh

My name is Harinder Singh and I specialize in Software industry. I consider myself as a life learner. I love learning new concepts, embracing new ideas and reading and searching for innovation.