title: Yii2 AJAX model validation ActiveForm
body: <p>When we are configuring Ajax validation for ActiveForm (for entire form) we can find it difficulty with input validation when our model looks like this:</p>
  
  <pre><code>[['file'],'file','skipOnEmpty'=&gt;false,'extensions'=&gt;['jpg', 'png', 'jpeg', 'pdf'],'checkExtensionByMimeType'=&gt;false,'maxSize' =&gt; 1024 * 1024 * 2,'message'=&gt;'Wrong format'],
  </code></pre>
  
  <p>It is not recommended to use AJAX for entire form when we have file input.</p>
  
  <p>In this particular situation AJAX will return error in validation even when our file is correctly selected. Way to do it correctly I will describe in answer.</p>
  
  <p>NOTE: This solution is not using external widget like yii2-widget-fileinput for examle, just standard Yii2 file input in ActiveForm.</p>