library yii2-widget-upload-oss
A widget for uploading files to AliYun OSS
mztest/yii2-widget-upload-oss
A widget for uploading files to AliYun OSS
- Monday, December 26, 2016
- by mztest
- Repository
- 0 Watchers
- 0 Stars
- 43 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
A widget for uploading files to AliYun OSS, (*1)
Installation
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require mztest/yii2-widget-upload-oss
or add, (*4)
"mztest/yii2-widget-upload-oss": "*"
to the require section of your composer.json
file., (*5)
Usage
-
Set signature action at your controller, (*6)
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',
],
],
];
}
-
Simply use it in your code by :, (*7)
<?= \mztest\uploadOSS\FileUploadOSS::widget(); ?>
or, (*8)
<?= $form->field($model, 'url')->widget(FileUploadOSS::className(), [
'signatureAction' => ['oss-signature']
]) ?>