Level 73
You will need a custom validation for that.
https://laravel.com/docs/7.x/validation#custom-validation-rules
Hi all,
I have a project here the requires the user to upload any of the below types in a single upload file: pdf,jpeg,png,xlsx,doc,docx
The file is being sent from an axios post and receive as base64. When I use this rule and only upload images the validation works:
$validator = Validator::make($request->all(), [
'file' => 'image|mimes:jpeg,png,jpg|max:10240',
]);
But as soon as I try to mix both types(files and images) the validation failed:
$validator = Validator::make($request->all(), [
'file' => 'mimes:jpeg,png,jpg,docx,doc,pdf,xlsx|max:10240',
]);
Is there a way to check for all types at the same time?
Any why please?
Thank you.
Please or to participate in this conversation.