yii2-jquery-fileupload-widget Blueimp jquery file upload widget for Yii2

  1. Requirements
  2. Installation
  3. Usage
  4. Resources

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

2 0
2 followers
0 downloads
Yii Version: 2.0
License: GPL-3.0
Category: User Interface
Developed by: limion
Created on: Feb 14, 2016
Last updated: 8 years ago