Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileValidator not validate #2330

Closed
mitalcoi opened this issue Feb 5, 2014 · 2 comments
Closed

FileValidator not validate #2330

mitalcoi opened this issue Feb 5, 2014 · 2 comments
Labels
status:to be verified Needs to be reproduced and validated. type:bug Bug

Comments

@mitalcoi
Copy link
Contributor

mitalcoi commented Feb 5, 2014

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.

@mitalcoi
Copy link
Contributor Author

mitalcoi commented Feb 5, 2014

i founded reason.if i write this in my controller:

        $model->load($_POST);
        $model->pic_hold=UploadedFile::getInstance($model, 'pic_hold');

everything works.

@qiangxue
Copy link
Member

qiangxue commented Feb 5, 2014

Yes, this is the expected usage.

@qiangxue qiangxue closed this as completed Feb 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated. type:bug Bug
Projects
None yet
Development

No branches or pull requests

3 participants