Files: Retrieving Uploaded Files

$file = $request->file('photo');

$file = $request->photo;
If ($request->hasFile('photo')) {

You may access uploaded files from a Illuminate\Http\Request instance using the file method or using dynamic properties.

You may determine if a file is present on the request using the hasFile method.

Validating Successful Uploads

If ($request->file('photo')->isValid()) {

In addition to checking if the file is present, you may verify that there were no problems uploading the file via the isValid method.

File Paths & Extensions

$path = $request->photo->path();

$extension = $request->photo->extension();

The UploadedFile class also contains methods for accessing the file's fully-qualified path and its extension.

Other File Methods

There are a variety of other methods available on UploadedFile instances.

Files: Retrieving Uploaded Files — Structure map

Clickable & Draggable!

Files: Retrieving Uploaded Files — Related pages: