title: Yii2 kartik file FileInput Multiple
body: <p>So I am working with Yii2 and am fairly new to it. I am using Kartik File upload and have attempted to convert the code for multiple files. but it only saves the first file.</p>
  
  <p>I have removed the validation as this was also failing but will add back in once I know all else is working. </p>
  
  <p>Model: </p>
  
  <pre><code>/**
      * Process upload of image
      *
      * @return mixed the uploaded image instance
      */
      public function uploadImage() {
  
          // get the uploaded file instance. for multiple file uploads
          // the following data will return an array (you may need to use
          // getInstances method)
           $image = UploadedFile::getInstances($this, 'image');
  
           foreach ($image as $images) {
  
          // if no image was uploaded abort the upload
          if (empty($images)) {
  
              return false;
          }
          // store the source file name
          $this-&gt;image_src_filename = $images-&gt;name;
          $extvar = (explode(".", $images-&gt;name));
          $ext = end($extvar);
  
  
          // generate a unique file name
          $this-&gt;image_web_filename = Yii::$app-&gt;security-&gt;generateRandomString().".{$ext}";
  
          // the uploaded image instance
  
          return $images;
  
  
  } }
  </code></pre>
  
  <p>Controller: </p>
  
  <pre><code>/**
       * Creates a new PhotoPhotos model.
       * If creation is successful, the browser will be redirected to the 'view' page.
       * @return mixed
       */
      public function actionCreate()
      {
          $model = new PhotoPhotos();
  
          if ($model-&gt;load(Yii::$app-&gt;request-&gt;post())) {
  
              // process uploaded image file instance
              $images = $model-&gt;uploadImage();
  
  
  
           if ($model-&gt;save(false)) {
  
              // upload only if valid uploaded file instance found
                  if ($images !== false) {
  
                      $path = $model-&gt;getImageFile();
                      $images-&gt;saveAs($path);
  
                  }
  
              return $this-&gt;redirect(['view', 'id' =&gt; $model-&gt;ID]);
          } else {
              //error in saving
  
          }
  
      }
              return $this-&gt;render('create', [
                  'model' =&gt; $model,
              ]);
      }
  </code></pre>
  
  <p>View: </p>
  
  <pre><code>//uncomment for multiple file upload
  echo $form-&gt;field($model, 'image[]')-&gt;widget(FileInput::classname(), [
      'options'=&gt;['accept'=&gt;'image/*', 'multiple'=&gt;true],
  ]);
  </code></pre>