Retrieving Uploaded Files in laravel

By | June 21, 2018

Access the uploaded file using Illuminate\Http\Request instance.

$file=$request->file(‘photo’) //File method
$file=$request->photo; //dynamic properties

here file method returns an instance of the Illuminate\Http\UploadedFile class, which extends the PHP SplFileInfo

A File is present on the request using has method

if ($request->hasFile(‘photo’)) {
//
}

Click here for more interview questions