In validator check mime type. https://laravel.com/docs/master/validation#rule-image
Jun 11, 2020
1
Level 8
Checking if variable is image/file without using request object
Hi everybody, I recently moved all my business logic to a service layer where I keep my Model methods now, I also noticed that making the arguments my methods received to perform different CRUD of the request class meant I was coupling my service layer to the HTTP/request domain.
At first I just went and changed $request->input('fieldName') for $request['fieldName'] and everything is good, but in order to handle file upload I use request method $request->file('file') and also $request->file('file')->isValid() in order to check if the variable is a file, is there an alternative way to check if variable is a file?
Please or to participate in this conversation.