Marlon's avatar

Validation mimes always returning error

Hello all!

I need upload compressed files, but it is optional, when the file is present I need to validate, I have a request to do that then I have tryed

'zip_file' => 'sometimes|mimes:zip|max:2048'
'zip_file' => 'sometimes|mimes:application/x-zip-compressed|max:2048'
'zip_file' => 'sometimes|mimes:application/x-compressed|max:2048'

And all the times (I have tryed one line per time sure) the validation returning error all times. Can anyone help me please?

Thanks in advance!

0 likes
4 replies
Marlon's avatar

Just the validation message when I try to upload any .zip file.

thomaskim's avatar
Level 41

Which one? Is it the wrong mime type? Did you go over the limit? Or maybe something else? Or all of it? It's hard to know where to start without these details.

Also, when you are submitting files, remember to add enctype="multipart/form-data" to your form tag.

Marlon's avatar

@thomaskim I made 2 changes this enctype="multipart/form-data" and 'zip_file' => 'sometimes|mimes:zip,rar|max:2048' And all worked like a charm.

Thank you for help!

Please or to participate in this conversation.