1. Go to this page and download the library: Download flexibuild/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/ */
flexibuild / file example snippets
php composer.phar
"flexibuild/file": "*"
// ...
public function behaviors()
{
return [
'fileModelBehavior' => [
'class' => \flexibuild\file\ModelBehavior::className(),
'attributes' => [
// add 'avatarFile' attribute that will be linked with 'avatar' property
// and use 'contact' context
'avatar' => 'contact',
],
],
];
}
// ...
public function rules()
{
return [
// ...
['avatarFile', 'file'/*, 'skipOnEmpty' => false */],
// ...
];
}
use flexibuild\file\widgets\bootstrap\ActiveFormEx;
// or flexibuild\file\widgets\ActiveFormEx without using bootstrap