Laravel - Requests - Retrieving Uploaded Files

You may retrieve uploaded files from an Illuminate\Http\Request instance using the file method or using dynamic properties. The file method returns an instance of the Illuminate\Http\UploadedFile class, which extends the PHP SplFileInfo class and provides a variety of methods for interacting with the file:

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

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

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