Closed mitalcoi closed 10 years ago
my AR:
public $pic_hold; ...... public function rules() { return [ ['pic_hold', 'file', 'types' => ['gif']], ]; }
and my view:
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <?= $form->field($model, 'pic_hold')->fileInput() ?> <?php ActiveForm::end(); ?>
If i trying to save jpeg, bmp, pdf, txt files - all of them succesful saving.
i founded reason.if i write this in my controller:
$model->load($_POST); $model->pic_hold=UploadedFile::getInstance($model, 'pic_hold');
everything works.
Yes, this is the expected usage.
my AR:
and my view:
If i trying to save jpeg, bmp, pdf, txt files - all of them succesful saving.