2017 © Pedro Peláez
 

yii2-extension file-upload

The ueditor extension for the Yii framework

image

hyiif/file-upload

The ueditor extension for the Yii framework

  • Tuesday, April 19, 2016
  • by yii-china.com
  • Repository
  • 4 Watchers
  • 8 Stars
  • 0 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

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 Versions

19/04 2016

dev-master

9999999-dev https://github.com/org-yii-china/yii2-file-upload.git

The ueditor extension for the Yii framework

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

by Xianan Huang

yii2 file-upload yii-china