In this article you will learn how to check file request by form submission. Suppose you will upload a file and submit form then if your form submission has file your output will dd the file.

  1. Just create a form like this
<form <em>action</em>="{{route('fileUpload')}}" <em>method</em>="post" <em>enctype</em>="multipart/form-data">
  <div <em>class</em>="custom-file">
    <input <em>type</em>="file" <em>name</em>="photo" <em>class</em>="custom-file-input" <em>id</em>="chooseFile" />
    <label <em>class</em>="custom-file-label" <em>for</em>="chooseFile">Select file</label>
  <button <em>type</em>="submit" <em>name</em>="submit" <em>class</em>="btn btn-primary btn-block mt-4">Upload Files</button>
  1. Make sure your route is matching with form action.
  2. Now check if your request has file.

namespace App\Http\Controllers;
use Illuminate\Http\Request;

class ProfileController extends Controller

    public function ProfilePicture(Request $request)
            'name' => 'required',
            'photo' => 'required',

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