PHP code example of maxmirazh33 / yii2-uploadable-file

1. Go to this page and download the library: Download maxmirazh33/yii2-uploadable-file 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/ */

    

maxmirazh33 / yii2-uploadable-file example snippets


public function behaviors()
    {
        return [
            [
                'class' => \maxmirazh33\file\Behavior::className(),
                'savePathAlias' => '@web/files/',
                'urlPrefix' => '/files/',
                'attributes' => [
                    'image' => [
                        'savePathAlias' => '@web/images/',
                        'urlPrefix' => '/images/',
                    ],
                    'file',
                ],
            ],
        //other behaviors
        ];
    }

echo $form->field($model, 'file')->widget('maxmirazh33\file\Widget');

echo Html::a('myCoolFile', $model->getFileUrl('file'));

use \maxmirazh33\file\GetFileUrlTrait

php composer.phar