https://github.com/postor/yii2-fileapi-sae
This widget is a Yii 2 wrapper of FileAPI plugin.
https://github.com/postor/yii2-fileapi-sae
Last synced: 2 months ago
JSON representation
This widget is a Yii 2 wrapper of FileAPI plugin.
- Host: GitHub
- URL: https://github.com/postor/yii2-fileapi-sae
- Owner: postor
- Created: 2015-05-31T09:10:55.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-05-31T10:10:41.000Z (almost 10 years ago)
- Last Synced: 2025-01-26T09:42:10.735Z (4 months ago)
- Language: PHP
- Homepage:
- Size: 137 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Yii2 FileAPI widget.
==================
This widget is a Yii 2 wrapper of [FileAPI](https://github.com/RubaXa/jquery.fileapi) plugin.this is an adapt for sina app engine
this is based on https://github.com/vova07/yii2-fileapi-widget
Installation
------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist "postor/yii2-fileapi-sae" "*"
```or add
```
"postor/yii2-fileapi-sae": "*"
```to the require section of your `composer.json` file.
Usage:
------```php
// MyController.phpuse postor\fileapi\actions\UploadAction as FileAPIUpload;
...public function actions()
{
return [
'fileapi-upload' => [
'class' => FileAPIUpload::className(),
'path' => 'saestor://upload/temp'
]
];
}
``````php
// MyModel.phpuse postor\fileapi\behaviors\UploadBehavior;
...public function behaviors()
{
return [
'uploadBehavior' => [
'class' => UploadBehavior::className(),
'attributes' => [
'preview_url' => [
'path' => 'saestor://upload/temp',
'tempPath' => 'saestor://upload/category',
'url' => $saeStorage->getUrl('upload','category'),
],
]
]
];
}
``````php
// _form.phpuse postor\fileapi\Widget as FileAPI;
...echo $form->field($model, 'preview_url')->widget(
FileAPI::className(),
[
'settings' => [
'url' => ['/controller/fileapi-upload']
]
]
);
```demo project: http://yii2postor.sinaapp.com/web/index.php?r=admin%2Fcategory%2Fupdate&id=2