1. Go to this page and download the library: Download open20/amos-attachments 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/ */
use yii\helpers\ArrayHelper;
/**
* Adding the file behavior
*/
public function behaviors()
{
return ArrayHelper::merge(parent::behaviors(), [
'fileBehavior' => [
'class' => \file\behaviors\FileBehavior::className()
]
]);
}
/**
* Add the new fields to the file behavior
*/
public function rules()
{
return ArrayHelper::merge(parent::rules(), [
[['my_field_multiple_files', 'my_field_single_file'], 'file'],
]);
}