Retrieving Input: 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.

Storing Uploaded Files

$path = $request->photo->store('images');

$path = $request->photo->store('images', 's3');
$path = $request->photo->storeAs('images', 'filename.jpg');

$path = $request->photo->storeAs('images', 'filename.jpg', 's3');

If you do not want a file name to be automatically generated, you may use the storeAs method.

Retrieving Input: Files — Structure map

Clickable & Draggable!

Retrieving Input: Files — Related pages: