peterbrinck's avatar

File upload validation dones't work with ZIP

Hi!

I have a whitelist of mimetypes that my users are allowed to upload. But somehow, zip files isn't allowed even though they're on the whitelist!

Here's my whitelist: mimetypes:image/jpeg,image/gif,image/png,application/msword,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/pdf,audio/mp3,audio/mpeg,audio/ogg,text/css,text/html,text/plain,text/xml,image/svg+xml,video/mp4,video/mpeg,video/quicktime,video/webm,video/x-m4v,video/x-flv,video/x-ms-wmv,video/x-msvideo,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-office,application/x-rar-compressed,application/zip,application/x-zip-compressed,application/x-compressed,multipart/x-zip

And my rule is as follows: $rules['attachments.*'] = 'required|mimetypes: ... ;

All the other files works correct, besides ZIP files, and I have NO idea why!

0 likes
3 replies
bobbybouwmann's avatar

I believe you need to use application/octet-stream for zip and rar files when uploading.

1 like
peterbrinck's avatar

I actually found out that it was that one ZIP-file I was testing with that was the problem, the validation works fine.

I was just surprised that I chose that one ZIP-file from my hundreds of ZIP-files available..

tallaljamshed's avatar

ok i have a problem . i used validation for mime types of all word files and pdf they are working fine. BUT i want it to stop accepting zip file and others that dont have any extention or those that are application/octet-stream. How can i do that.???

Please or to participate in this conversation.