Search code examples
yiiyii-extensionsdropzone.js

dropzone.js doesnt upload .doc,.xls,.xlsx file formats


i have use dropzone extension to upload images. it work like charm. but i want to upload document files doc,docx,xls,xlsx.

$this->widget('ext.dropzone.EDropzone', array(
                     'model' => $model,
                     'attribute' => 'image_name',
                     'url' => Yii::app()->request->baseUrl.'/jobMaster/ImageUpload',
                     'mimeTypes' => array('image/jpeg', 'image/png','image/jpg'),
                     'onSuccess' => 'succcesupload',
                     //'maxFilesize'=> 5,
                     'options' => array(
                       'addRemoveLinks'=> true,
                     'removedfile'=> "js:function(file) {
                        var name = file.name;        
                        $.ajax({
                            type: 'POST',
                            url: '".$this->createUrl('/jobMaster/deleteImageUpload')."',
                            data: 'id='+name,
                            dataType: 'html'
                        });
                        var _ref;
                        return (_ref = file.previewElement) != null ? _ref.parentNode.removeChild(file.previewElement) : void 0;        
                                      }"
                 )
                     ));

But i don't know how to change in this widget.

i change

'mimeTypes' => array('image/jpeg', 'image/png','image/jpg','file/doc','file/xls','file/xlsx','file/docx'),

but it doesn't work. Any answer?


Solution

  • Here i got solution

    'mimeTypes' => array('image/jpeg', 'image/png','image/jpg','application/vnd.ms-excel','application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/docx','application/pdf','text/plain','application/msword','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'),