https://github.com/boundstate/yii2-plupload
A plupload extension for Yii2
https://github.com/boundstate/yii2-plupload
Last synced: about 1 year ago
JSON representation
A plupload extension for Yii2
- Host: GitHub
- URL: https://github.com/boundstate/yii2-plupload
- Owner: boundstate
- Created: 2015-08-10T21:39:03.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-05-28T07:59:10.000Z (about 9 years ago)
- Last Synced: 2024-09-15T23:52:16.932Z (almost 2 years ago)
- Language: PHP
- Size: 121 KB
- Stars: 2
- Watchers: 3
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# yii2-plupload
A [plupload](http://www.plupload.com/) extension for the Yii2 framework
## Installation
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```sh
php composer.phar require --prefer-dist boundstate/yii2-plupload "*"
```
or add
```
"boundstate/yii2-plupload": "*"
```
to the require section of your `composer.json` file.
## Usage
### Action
```php
public function actions() {
return [
'upload' => [
'class' => PluploadAction::className(),
'onComplete' => function ($filename, $params) {
// Do something with file
}
],
];
}
```
### Widget
```php
= Plupload::widget([
'url' => ['upload'],
'browseLabel' => 'Upload',
'browseOptions' => ['id' => 'browse', 'class' => 'btn btn-success'],
'options' => [
'filters' => [
'mime_types' => [
['title' => 'Excel files', 'extensions' => 'csv,xls,xlsx'],
],
],
],
'events' => [
'FilesAdded' => 'function(uploader, files){
$("#error-container").hide();
$("#browse").button("loading");
uploader.start();
}',
'FileUploaded' => 'function(uploader, file, response){
$("#browse").button("reset");
}',
'Error' => 'function (uploader, error) {
$("#error-container").html(error.message).show();
$("#browse").button("reset");
}'
],
]); ?>
```