hellopeter13's avatar

laravel validation rule is not accepting .doc, .docx file

Hi, I'm trying to upload a file, and I've added a validation rule for the file

'resume' => ['required', 'mimes:jpg,jpeg,pdf,application/msword'],

but every time i try to upload the file, it gives the error that .doc or .docx files are not accepted

any solution?

0 likes
2 replies
LaryAI's avatar
LaryAI
AI
Best Answer
Level 58

The issue is with the MIME type of the .doc and .docx files. You need to add the MIME types for these file types in the validation rule. Here's an updated validation rule that should work:

'resume' => ['required', 'mimes:jpg,jpeg,pdf,doc,docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document'],

This adds the MIME types for .doc and .docx files.

Please or to participate in this conversation.