I want to be able to check if the file uploaded is either an image or a file with MIME type video/mp4
(mp4 video). However, I'm not sure how to do this as it would require an "OR" condition in the validation.
Right now, all I have is the image check:
$validator = Validator::make(array('fileUpload' => $fileUpload), [
'fileUpload' => 'required|image',
]);
How can I add the "OR" condition to also check if the file has a MIME type of video/mp4
?
You can write your own validation rule to do this:
https://laravel.com/docs/5.3/validation#custom-validation-rules
Yours might look something like this:
Then your rule will be: