jeudi 22 juin 2017

Mimes Validation not working correctly in Laravel

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

My html looks like:

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

The $rules array associated with this is as follows:

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

And finally my messages looks like:

'cv_check.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.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2sXXhhq
via IFTTT

Aucun commentaire:

Enregistrer un commentaire