title: Input type file activeform Yii2 generate another input type hidden
body: <p>I have some problem when using activeform type file. When i try to send my input in registration controller the validation from model always return it false because there is input type file that empty. After i checking from html inspect elements, it turns out that the form I created on the register page generates a new input on it with the type hidden and the same name. I still can't understand why it can generate another input type hidden and input post in controller read from that input type hidden</p>
  <p>this is my activeform:</p>
  <pre><code>&lt;?php $form = ActiveForm::begin(['id' =&gt; 'form-signup', 'action' =&gt; '/site/register/userregister', 'options' =&gt; ['enctype' =&gt; 'multipart/form-data'], 'method' =&gt; 'post' ]); ?&gt;
      
        &lt;?= $form-&gt;field($model,'email')-&gt;textInput()-&gt;input('email', ['placeholder' =&gt; &quot;Email&quot;])-&gt;label(false) ?&gt;
  
        &lt;?= $form-&gt;field($model,'photofile',
                ['options' =&gt; ['class' =&gt; 'form-group']])
              -&gt;fileInput([])
              -&gt;label('Photo file&lt;br/&gt;&lt;span style=&quot;font-size:12px;font-style:italic;&quot;&gt;(Max. size 1 MB, Allowed type: .jpg, .jpeg, .png)&lt;/span&gt;') ?&gt;
  
        &lt;?= $form-&gt;field($model,'resumefile',
                ['options' =&gt; ['class' =&gt; 'form-group']])
              -&gt;fileInput([])
              -&gt;label('Resume file&lt;br/&gt;&lt;span style=&quot;font-size:12px;font-style:italic;&quot;&gt;(Max. size 1 MB, Allowed type: .doc, .docx, .pdf)') ?&gt;
  
        &lt;div class=&quot;form-group&quot;&gt;
            &lt;?= Html::submitButton('Sign Up', ['class' =&gt; 'btn btn-sign', 'type' =&gt; 'submit']) ?&gt;
        &lt;/div&gt;
        &lt;h6 class=&quot;mt-3&quot;&gt;Have an account?&amp;nbsp;&amp;nbsp;&lt;a class=&quot;font-weight-bold&quot; href=&quot;&lt;?= Url::to(['login/userlogin']) ?&gt;&quot;&gt;Sign In&lt;/a&gt;&lt;/h6&gt;
  
      &lt;?php ActiveForm::end(); ?&gt;
  </code></pre>
  <p>this my controller :</p>
  <pre><code>public function actionUserregister()
    {
      $model = new SignupModel();
  
      if (Yii::$app-&gt;request-&gt;isPost) {
  
          $input = Yii::$app-&gt;request-&gt;post('SignupModel');
          echo &quot;&lt;pre&gt;&quot;;var_dump($input);exit;
      }
    }
  </code></pre>
  <p>this is function in to validate rule input:</p>
  <pre><code>public function rules()
      {
          return [
  
            ['photofile', 'required'],
            ['photofile', 'file', 'extensions' =&gt; 'jpg,jpeg,png', 'maxSize' =&gt; 1024 * 1024 * 1],
  
            ['resumefile', 'required'],
            ['resumefile', 'file', 'extensions' =&gt; 'pdf,doc,docx', 'maxSize' =&gt; 1024 * 1024 * 1 ],
          ];
      }
  </code></pre>
  <p>and this is what i see in inspect elements:</p>
  <pre><code>&lt;div class=&quot;form-group field-signupmodel-photofile required&quot;&gt;
    &lt;label class=&quot;control-label&quot; for=&quot;signupmodel-photofile&quot;&gt;Photo file&lt;/label&gt;
    &lt;input type=&quot;hidden&quot; name=&quot;SignupModel[photofile]&quot; value&gt;    //here is the problem
    &lt;input type=&quot;file&quot; id=&quot;signupmodel-photofile&quot; name=&quot;SignupModel[photofile]&quot; aria-required=&quot;true&quot;&gt;
    &lt;p class=&quot;help-block help-block-error&quot;&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;form-group field-signupmodel-resumefile required&quot;&gt;
    &lt;label class=&quot;control-label&quot; for=&quot;signupmodel-resumefile&quot;&gt;Resume file&lt;/label&gt;
    &lt;input type=&quot;hidden&quot; name=&quot;SignupModel[resumefile]&quot; value&gt;   //here is the problem
    &lt;input type=&quot;file&quot; id=&quot;signupmodel-resumefile&quot; name=&quot;SignupModel[resumefile]&quot; aria-required=&quot;true&quot;&gt;
    &lt;p class=&quot;help-block help-block-error&quot;&gt;&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  <p>what's wrong with my code above?</p>