Skip to content

Conversation

@aadutskevich
Copy link

The same issue as it was with standart yii2 fileInput yiisoft/yii2#8779

The same issue as it was with standart yii2 fileInput yiisoft/yii2#8779
@kartik-v
Copy link
Owner

kartik-v commented May 5, 2017

Will not work here the way the code is written - because this class is not an instance of yii\widgets\ActiveField unlike the yii fileinput which is an activefield instance.

This FileInput widget here can be used with and without a form and via ajax as well... so it makes sense for users to set the enctype property to the form based on their own need (as it is not mandatory for the other cases like ajax).

@aadutskevich aadutskevich deleted the patch-1 branch May 5, 2017 11:54
@aadutskevich aadutskevich restored the patch-1 branch May 5, 2017 11:55
@aadutskevich
Copy link
Author

Ok, let we add an instance check, So if we use widget with ActiveField then the form enctype option will be created.

    `if ($this->field instanceof \yii\widgets\ActiveField && !isset($this->field->form->options['enctype'])) {
	    $this->field->form->options['enctype'] = 'multipart/form-data';
    }`

@kartik-v
Copy link
Owner

kartik-v commented May 5, 2017

Ok -- this above code will work for InputWidget... will figure out and include this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants