Привет , есть такой мини код
<?
use yii\helpers\Html;
use yii\widgets\ActiveForm;
?>
<? if ($name) {?><h1>Ati introdus <b><?=$name;?></b> and <b><?=$email;?></b></h1> <? }?>
<? $f = ActiveForm::begin(['options'=>['enctype' => 'multipart/form-data']]);?>
<?=$f->field($form,'name')?>
<?=$f->field($form,'email')?>
<?= $f->field($form, 'imageFile')->fileInput() ?>
<?=Html::submitButton('Send');?>
<? ActiveForm::end();?>
ругается на строку
<?=$f->field($form,'file') -> fileInput()?>
Unknown Property – yii\base\UnknownPropertyException
Getting unknown property: app\models\MyForm::file
В чем проблема ?
Up .
Вот и модель
<?
namespace app\models;
use Yii;
use yii\base\Model;
class MyForm extends Model {
public $name;
public $email;
public function rules () {
return [
[ ['name','email'],'required'],
['email','email','message'=>'Email gresit'],
[['imageFile'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg']
];
}
}
?>