Upload archive files (rar,zip)

#1

Hi, I’m developing a site and unable to add rar and zip files to allowedFileTypes.
Trying with value:
['image/*', 'video/*', 'application/zip', 'application/x-rar-compressed', 'application/vnd.rar']
The default error message is shown when trying to upload a winrar created rar or zip file:
You can only upload: image/*, video/*, application/zip, application/x-rar-compressed, application/vnd.rar
What is wrong here?
PLS help!

0 Likes

#2

Hi! Which browser are you using? It’s possible that one doesn’t recognise RAR files correctly.

As a workaround, you can add acceptable extensions to your list:

['application/vnd.rar', '.rar']

Now, if the browser doesn’t recognise the vnd.rar MIME type, files named xyz.rar will still be accepted.

2 Likes

#3

Great solution! Thanks! Did not find anything about this anywhere, and di look multiple times… It was chrome. And it works with ‘.zip’ too.

0 Likes