yii - dropzone.js 不上传 .doc、.xls、.xlsx 文件格式

标签 yii yii-extensions dropzone.js

我使用 dropzone 扩展来上传图片。它像魅力一样工作。但我想上传文档文件 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;        
                                      }"
                 )
                     ));

但我不知道如何更改此小部件。

我改变

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

但它不起作用。有答案吗?

最佳答案

这里有解决方案

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

关于yii - dropzone.js 不上传 .doc、.xls、.xlsx 文件格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28337198/

相关文章:

javascript - Yii2 Active Record 在 where 子句中使用 FIND_IN_SET

jquery - 删除 jquery datepicker alt 中的 3 个点

所有链接上的 yiiSkeletonApp 错误 404

javascript - Dropzone.js 提交多个 id

javascript - Dropzone.js : Upload file without Browse dialog in php-webdriver integration tests

c# - 使用dropzone需要添加额外的值

php - 哪个是最好的 php 框架?

php - Yii 框架扩展

php - 如何在 Yiibooster 中使用配置 TbEditableColumn?

yii - 在 Yii 中删除用户时如何实现电子邮件确认