https://github.com/vova07/yii2-fileapi-widget
Yii2 FileAPI widget.
https://github.com/vova07/yii2-fileapi-widget
file-upload fileapi yii2 yii2-extension yii2-fileapi-widget yii2-widgets
Last synced: 21 days ago
JSON representation
Yii2 FileAPI widget.
- Host: GitHub
- URL: https://github.com/vova07/yii2-fileapi-widget
- Owner: vova07
- Created: 2014-08-28T17:02:50.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-05-27T17:27:25.000Z (almost 7 years ago)
- Last Synced: 2025-04-07T07:42:51.771Z (about 2 months ago)
- Topics: file-upload, fileapi, yii2, yii2-extension, yii2-fileapi-widget, yii2-widgets
- Language: PHP
- Size: 32.2 KB
- Stars: 47
- Watchers: 11
- Forks: 27
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WARNING: This extension is not more maintained (The base JS script [FileAPI](https://github.com/RubaXa/jquery.fileapi) was deprecated)
Yii2 FileAPI widget.
==================
This widget is a Yii 2 wrapper of [FileAPI](https://github.com/RubaXa/jquery.fileapi) plugin.Installation
------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist vova07/yii2-fileapi-widget "*"
```or add
```
"vova07/yii2-fileapi-widget": "*"
```to the require section of your `composer.json` file.
Usage:
------```php
// MyController.phpuse vova07\fileapi\actions\UploadAction as FileAPIUpload;
...public function actions()
{
return [
'fileapi-upload' => [
'class' => FileAPIUpload::className(),
'path' => '/path/to/temp/files'
]
];
}
``````php
// MyModel.phpuse vova07\fileapi\behaviors\UploadBehavior;
...public function behaviors()
{
return [
'uploadBehavior' => [
'class' => UploadBehavior::className(),
'attributes' => [
'preview_url' => [
'path' => '/path/to/previews',
'tempPath' => '/path/to/temp/files/previews',
'url' => '/url/to/previews'
],
'image_url' => [
'path' => '/path/to/images',
'tempPath' => '/path/to/temp/files/images',
'url' => '/url/to/images'
]
]
]
];
}
``````php
// _form.phpuse vova07\fileapi\Widget as FileAPI;
...echo $form->field($model, 'preview_url')->widget(
FileAPI::className(),
[
'settings' => [
'url' => ['/controller/fileapi-upload']
]
]
);
```