PHP code example of rezident / yii2-attach-file

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

    

rezident / yii2-attach-file example snippets


return [
    //.....
    'modules' => [
        //.....
        'attach_file' => [
            'class' => rezident\attachfile\AttachFileModule::class,
            'originalsPath' => '@app/files/originals',
            'viewsPath' => '@app/files/views',
            'webPath' => '@app/files/views'
        ]
    ]
];

public function behaviors()
{
    return [
        'specified' => [
            'class' => rezident\attachfile\behaviors\AttachFileBehavior::class,
            'modelKey' => 'specified' // If it is not specified, will be used the short name of the model class
        ]
    ];
}