skeeks-semenov / yii2-ajax-file-upload

BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Yii2 file upload

Latest Stable Version Total Downloads

Installation

Either run

php composer.phar require --prefer-dist skeeks/yii2-ajax-file-upload "*"

or add

"skeeks/yii2-ajax-file-upload": "*"

Configuration web app


'modules' => 
[
    'ajaxfileupload' => [
        'class'         => 'skeeks\yii2\ajaxfileupload\AjaxFileUploadModule',

        'controllerMap' => [
            'upload' => [
                'class'                 => 'skeeks\yii2\ajaxfileupload\controllers\UploadController',
                'private_tmp_dir'       => '@runtime/ajaxfileupload',
            ]
        ]
    ]
]

Configuration console app


'modules' => 
[
    'ajaxfileupload' => [
        'class'                 => 'skeeks\yii2\ajaxfileupload\AjaxFileUploadModule',
        'controllerNamespace'   => 'skeeks\yii2\ajaxfileupload\console\controllers'

        'controllerMap' => [
            'upload' => [
                'class'                 => '\skeeks\yii2\ajaxfileupload\controllers\UploadController',
                'private_tmp_dir'       => '@runtime/ajaxfileupload',
            ]
        ]
    ]
]

Console commands

php yii ajaxfileupload/cleanup

Usage

echo $form->field($model, 'image_src')->widget(
            \skeeks\yii2\ajaxfileupload\widgets\AjaxFileUploadWidget::class,
            [
                'accept' => 'image/*',
                //'view_file' => '@skeeks/yii2/ajaxfileupload/widgets/views/buttons',
                //'itemOptions' => [
                //    'class' => 'col-lg-6 col-md-6 col-sm-6 sx-file sx-state-success'
                //]
            ]
        );

Links


skeeks! SkeekS CMS (Yii2) — quickly, easily and effectively!
skeeks.com | cms.skeeks.com