Dha*_*ara 2 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;
}"
)
));
Run Code Online (Sandbox Code Playgroud)
但我不知道如何改变这个小部件.
我改变
'mimeTypes' => array('image/jpeg', 'image/png','image/jpg','file/doc','file/xls','file/xlsx','file/docx'),
Run Code Online (Sandbox Code Playgroud)
但它不起作用.有答案吗?
我在这里得到解决方案
'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'),
Run Code Online (Sandbox Code Playgroud)