title: Illegal offset type in isset or empty
body: <p>Current PHP version: 7.1.7</p>
  
  <p>please help me I have this problem </p>
  
  <blockquote>
    <p>Illegal offset type in isset or empty at line 113</p>
  </blockquote>
  
  <p>I have this problem after I decided to upload files to my website </p>
  
  <p>in C:\xampp\htdocs\archive\vendor\yiisoft\yii2\web\UploadedFile.php
  line 113:</p>
  
  <pre><code> public static function getInstanceByName($name)
  {
      $files = self::loadFiles();
      return isset($files[$name]) ? new static($files[$name]) : null;
  }
  </code></pre>
  
  <p>and guys if this not clear ask me for more explication and thanks</p>
  
  <p>This code in models</p>
  
  <pre><code>[['file'],'file'],
  </code></pre>
  
  <ul>
  <li><p>this code in controllers</p>
  
  <pre><code>            $docfileload = $model-&gt;docname;
          $model-&gt;file = UploadedFile::getinstancebyname($model,'file');
          $model-&gt;file-&gt;saveAs('uploads/'.$docfileload.'.'.$model-&gt;file-&gt;extension);
          $model-&gt;save();
  
          //save path in db
          $model-&gt;docfile = 'uploads/'.$docfileload.'.'.$model-&gt;file-&gt;extension;
  </code></pre></li>
  </ul>
  
  <p>this code in _form</p>
  
  <pre><code>    &lt;?= $form-&gt;field($model,'file')-&gt;fileinput(); ?&gt;
  </code></pre>
  
  <p>in first I used getInstance() but replecd getInstanceByName() because had porblem here</p>
  
  <p><a href="https://stackoverflow.com/questions/45902581/error-yii2-upload-call-to-a-member-function-saveas-on-null">error yii2 upload Call to a member function saveAs() on null</a></p>