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

Dhara picture Dhara · Feb 5, 2015 · Viewed 10.5k times · Source

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?

Answer

Dhara picture Dhara · Jun 3, 2015

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'),