Yii 2.0: yii2-jquery-fileupload-widget

Blueimp jquery file upload widget for Yii2
1 follower

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

Be the first person to leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet