maddoger/yii2-filebehavior File behavior for Yii2.

yii2-filebehavior

File field behavior for Yii 2

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist maddoger/yii2-filebehavior "*"

or add

"maddoger/yii2-filebehavior": "*"

to the require section of your composer.json file.

In model behaviors:

[
    'class' => 'maddoger\filebehavior\FileBehavior',
    'attribute' => 'file_attribute',
    'deleteAttribute' => 'deleteFile',
    'fileName' => function ($model, $file, $index) {
        return md5($file->name).'.'.$file->extension;
    },
    'basePath' => '@webapp/uploads/files',
    'baseUrl' => '@web/uploads/files',
    'overwriteFile' => false,
],

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



v1.1.2 is the latest of 5 releases



Unknown license
Stats
0 github stars & 1 github forks
0 downloads in the last day
7 downloads in the last 30 days
993 total downloads