Yii2 port of BlueImp jQuery File Upload plugin. File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads and client-side image resizing.
One widget, simple configuration, everything works out of the box.
Requirements ¶
Yii 2.0 or above
Installation ¶
Add to your composer.json
"require": {
"limion/yii2-jquery-fileupload-widget": "~1.0"
}
Usage ¶
UI version ¶
See: https://blueimp.github.io/jQuery-File-Upload/index.html
Please note, in case of using a "UI" version you need to embed the widget to an existing form.
<?php
use limion\jqueryfileupload\JQueryFileUpload;
<?php $form = ActiveForm::begin(); ?>
<?= JQueryFileUpload::widget([
'name' => 'files[]',
'url' => ['upload', 'someparam' => 'somevalue'], // your route for saving images,
'appearance'=>'ui', // available values: 'ui','plus' or 'basic'
'formId'=>$form->id,
'options' => [
'accept' => 'image/*'
],
'clientOptions' => [
'maxFileSize' => 2000000,
'dataType' => 'json',
'acceptFileTypes'=>new yii\web\JsExpression('/(\.|\/)(gif|jpe?g|png)$/i'),
'autoUpload'=>false
]
]);?>
<?php ActiveForm::end(); ?>
Resources ¶
More information and examples see on GitHub: https://github.com/limion/yii2-jquery-fileupload-widget
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.