2017 © Pedro Peláez
 

yii2-extension yii2-qiniu-upload

yii2集成七牛文件上传

image

yii-china/yii2-qiniu-upload

yii2集成七牛文件上传

  • Tuesday, May 15, 2018
  • by yii-china.com
  • Repository
  • 1 Watchers
  • 1 Stars
  • 35 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 6 % Grown

The README.md

图片上传 yii2-qiniu-upload

yii2图片上传到七牛的扩展, (*1)

@from Yii中文网(www.yii-china.com), (*2)

安装(Installation)

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist yii-china/yii2-qiniu-upload "~1.0.0"

or add, (*5)

"yii-china/yii2-qiniu-upload": "~1.0.0"

to the require section of your composer.json file., (*6)

用法(Usage)

view


['enctype' => 'multipart/form-data']]); ?> ... <?= $form->field($model, 'image')->widget(\Ycn\Qiniu\UploadWidget::className(),['options'=>[            'domain' => 'http://img.itdocs.org' //七牛图片服务域名    ]]) ?> ...

controller

//获取文件上传对象
$file = UploadedFile::getInstance($model, 'image');

//实例化上传对象
$up = UploadService::getInstance(
  Yii::$app->params['qiniu']['ak'],  //七牛的AK
  Yii::$app->params['qiniu']['sk'],  //七牛的SK
  Yii::$app->params['qiniu']['bucket']  //七牛的BUCKET
);

//可以自定义图片文件名 作为upload第二个参数
//$fileName = date("YmdHis").rand(10000,99999).'.jpg';

//图片上传临时路径
$filePath= $file->tempName;

//调用upload上传图片到七牛
$response = $up->upload($filePath);

return $response;

The Versions

15/05 2018

dev-master

9999999-dev

yii2集成七牛文件上传

  Sources   Download

MIT

The Requires

 

by huangxianan

yii2 文件上传 七牛 图片上传

15/05 2018

1.2.0

1.2.0.0

yii2集成七牛文件上传

  Sources   Download

MIT

The Requires

 

by huangxianan

yii2 文件上传 七牛 图片上传

08/05 2018

v1.1.1

1.1.1.0

yii2集成七牛文件上传

  Sources   Download

MIT

The Requires

 

by huangxianan

yii2 文件上传 七牛 图片上传

02/05 2018

1.1.0

1.1.0.0

yii2集成七牛文件上传

  Sources   Download

MIT

The Requires

 

by huangxianan

yii2 文件上传 七牛 图片上传

24/04 2018

1.0.0

1.0.0.0

yii2集成七牛文件上传

  Sources   Download

MIT

The Requires

 

by huangxianan

yii2 文件上传 七牛 图片上传