Before we go ahead and make a few changes to the generated UploadController stub, I think it makes more sense to create a request class first. This is because the controller method that handles the request must enter a hint for the request object in its signature, which will allow it to automatically validate the form input (as specified in the rules () method. More on that later …) let’s use the command again artisan to stub our request:
php artisan make: request UploadFileRequest
This command will create a file named UploadFileRequest inside the app / Http / Requests / UploadFileRequest. Open the stub and take a look … you will find it very simple, containing only two methods, authorize () and rules.