How to make validation rules to upload pdf, doc and docx files in laravel 5.4 How to make validation rules to upload pdf, doc and docx files in laravel 5.4
Tried:
'fileUpload' => 'required|mimes:jpeg,png,jpg,doc,docx,pdf|max:2048',
But doc and docx are not working.
Thanks,
actually doc and docx are zip files so I added zip instead of doc, docx and its working.
'fileUpload' => 'required|mimes:jpeg,png,jpg,zip,pdf|max:2048',
For Laravel 7+ to validate doc, docx you need to create mimes.php in config directory and add the following content,
config/mimes.php
<?php
return [
'doc' => array('application/msword', 'application/vnd.ms-office'),
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'),
];
Please sign in or create an account to participate in this conversation.