PHP code example of aminkt / yii2-upload-manager

1. Go to this page and download the library: Download aminkt/yii2-upload-manager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aminkt / yii2-upload-manager example snippets


'upload-manager' => [
    'class' => aminkt\uploadManager\UploadManager::class,
    'uploadPath'=>Yii::getAlias("@frontendWeb")."/upload",
    'uploadUrl'=> "/upload",
    'baseUrl' => 'http://localhost:800',
    'acceptedFiles'=>"*",
    'userClass' => 'user/class/namespcae',
    'fileClass' => 'file/class/namespcae', // Don't set this to use default active record.
    'fileSearchClass' => 'file/search/class/namespcae', // Don't set this to use default search active record.
],

php yii migrate --migrationPath="@vendor/aminkt/yii2-upload-manager"

 echo \aminkt\uploadManager\components\UploadManager::widget([
    'id'=>'upload-user-pic-'.$model->id,
    'model'=>$model,
    'attribute'=>'picture',
    'titleTxt'=>'تصویر ربات را  کنید.',
    'helpBlockEnable'=>false,
    'showImageContainer'=>'#avatar-'.$model->id,
    'showImagesTemplate'=>"<img src='{url}' class='img-responsive'>",
    'btnTxt'=>'<i class="fa fa-edit"></i>'
]);
echo Html::hiddenInput('target', $model->id, ['class'=>'target']);

[
    'class' => 'yii\rest\UrlRule',
    'pluralize' => false,
    'controller' => ['v2/upload' => 'uploadManager/v1/upload'],
    'extraPatterns' => [
        'GET load/<id:\d+>' => 'load',
    ]
],