Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dropzone.js - acceptedMimeTypes

I am trying to implement some limitation to the file types allowed for upload using dropzone.js. Somehow the below code works for Word, Excel and Powerpoint documents but it doesn't work for .zip and .rar. Any suggestions?

   Dropzone.options.filedrop = {
        maxFilesize: 4096,
        acceptedMimeTypes: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/excel,application/vnd.ms-excel,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.openxmlformats-officedocument.presentationml.slideshow, application/x-rar-compressed, application/x-rar, application/octet-stream,application/zip, compressed/rar,application/rar,application/x-compressed,multipart/x-zip,multipart/x-rar',
        }
like image 625
Subliminal Hash Avatar asked Oct 22 '22 08:10

Subliminal Hash


1 Answers

If this question (and its answers) are any indication, you may be able to avoid explicitly listing the mime-type in favour of simple .extension style.

From what I have examined in the dropzone.js source code, all that the library does it check that the mimetypes are valid, and then assign them as the accept attribute on the file input element.

like image 85
NT3RP Avatar answered Oct 27 '22 10:10

NT3RP