dev-master
9999999-dev https://github.com/org-yii-china/yii2-file-upload.gitThe ueditor extension for the Yii framework
BSD-3-Clause
The Requires
- php >=5.3.0
by Xianan Huang
yii2 file-upload yii-china
Wallogit.com
2017 © Pedro Peláez
The ueditor extension for the Yii framework
Yii2 插件整合-图片上传(file-upload), (*1)
实例教程:http://www.yii-china.com/post/detail/15.html, (*2)
安装扩展:, (*3)
1.点击上面扩展下载下载扩展, (*4)
然后重命名为file_upload放在/common/widgets文件夹中, (*5)
2.在使用图片上传控件的控制器(controller)中,加入以下代码, (*6)
public function actions()
{
return [
'upload'=>[
'class' => 'common\widgets\file_upload\UploadAction', //这里扩展地址别写错
'config' => [
'imagePathFormat' => "/image/{yyyy}{mm}{dd}/{time}{rand:6}",
]
]
];
}
3.views渲染图片上传界面有两种方式:, (*7)
第一种:不带model, (*8)
use common\widgets\file_upload\FileUpload; //引入扩展 echo FileUpload::widget(); echo FileUpload::widget(['value'=>$url]); //如果编辑时要带默认图,$url为图片路径
第二种:带model, (*9)
$form = ActiveForm::begin();
echo $form->field($model, 'label_img')->widget('common\widgets\file_upload\FileUpload',[
'config'=>[
'图片上传的一些配置,不写调用默认配置'
]
]);
ActiveForm::end();
The ueditor extension for the Yii framework
BSD-3-Clause
yii2 file-upload yii-china