3 years ago

Mimes Validation not working correctly in Laravel

Posted 3 years ago by tareenmj

My webpage contains a file for upload, and I want the file uploaded to only be either pdf, doc or docx.

My form tag also has enctype="multipart/form-data" and has files="true"

My html looks like:

<div id="cv_upload" class="row">
    <div class="col-xs-12">
          <input type="file" name='cv'>

The $rules array associated with this is as follows:

'cv' => 'mimes:pdf,doc,docx|required'

And finally my messages looks like:

'cv.required' => 'A selection for C.V. is required before proceeding.',
'cv.mimes' => 'CV must be of the following file type: pdf, doc or docx.'

The only problem with this is, even after I upload a pdf or doc, the message I receive is the one for required. I have no idea why this isn't working as expected. I also tried removing the 'application/' but that yields no success either. Please help.

Please sign in or create an account to participate in this conversation.