vendredi 2 février 2018

Laravel 5.5 file extension validation not working

Requirement: User can only upload pdf, word document, excel or powerpoint. I have tried these validations rules and none of them are working:

'fileUpload' => 'sometimes|mimes:doc,docx,xls,xlsx,ppt,pdf,zip|max:2048',

I have also tried below rule to test pdf.

'fileUpload' => 'sometimes|mimetypes:application/pdf|max:2048',

When I try to upload any file it says:

The file upload must be a file of type: doc, docx, xls, xlsx, ppt, pdf, zip.

I am manually handling this requirement. But want to know why these validation rules are not working.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire