2017 © Pedro Peláez
 

yii2-extension file_upload

yii2.0 upload

image

mrfeng/file_upload

yii2.0 upload

  • Saturday, May 21, 2016
  • by MRfeng
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Yii2 插件整合-图片上传(file-upload), (*1)

实例教程:稍后附上, (*2)

安装扩展:, (*3)

1.composer require mrfeng/file_upload, (*4)

2.在使用图片上传控件的控制器(controller)中,加入以下代码, (*5)

public function actions()
{
    return [
        'upload' => [
            'class' => 'mrfeng\yii2upfile\UploadAction',
            'config'=>[
                //配置图片上传存储绝对地址
                'uploadFilePath'=>dirname(dirname(__DIR__)).'/uploads',
                //配置图片上传格式化地址
                'imagePathFormat'=>'/image/{yyyy}{mm}{dd}/{time}{rand:6}'
            ]
        ]
    ];
}

3.views渲染图片上传界面有两种方式:, (*6)

    //'config'=>['domain_url'=>'http://pic.yygo.com'] 配置图片访问前缀 我这里是专门为上传目录绑定一个二级域名
    = $form->field($model,'thumb')->widget('mrfeng\yii2upfile\FileUpload',['config'=>['domain_url'=>'http://pic.yygo.com']]);?>

The Versions

21/05 2016

dev-master

9999999-dev

yii2.0 upload

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

by Avatar MRfeng