mztest/yii2-widget-upload-oss

A widget for uploading files to AliYun OSS

1.0.0 2016-12-05 09:32 UTC

This package is not auto-updated.

Last update: 2024-04-27 17:53:22 UTC


README

A widget for uploading files to AliYun OSS

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require mztest/yii2-widget-upload-oss

or add

"mztest/yii2-widget-upload-oss": "*"

to the require section of your composer.json file.

Usage

  1. Set signature action at your controller

    public function actions()
    {
        return [
            'upload' => [
                'oss-signature' => [
                    'class' => 'mztest\uploadOSS\actions\Signature',
                    'accessKeyId' => 'Your aliyunOSS access key id here.',
                    'accessKeySecret' => 'Your aliyunOSS access secret id here.',
                    'host' => 'Your aliyunOSS upload bucket url',
                ],
            ],
        ];
    }
  2. Simply use it in your code by :

    <?= \mztest\uploadOSS\FileUploadOSS::widget(); ?>

    or

    <?= $form->field($model, 'url')->widget(FileUploadOSS::className(), [
        'signatureAction' => ['oss-signature']
    ]) ?>