Answer the question
In order to leave comments, you need to log in
Unknown Property - yii\base\UnknownPropertyException?
Hello, there is such a minicode
<?
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()?>
<?
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']
];
}
}
?>
Answer the question
In order to leave comments, you need to log in
it is written in the app\models\MyForm class there is no file attribute ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question