title: uploading multiple files using one file field in codeigniter
body: <p><strong>SOLVED</strong>
  I have a file field named <code>additional_photos[]</code> on a web page, there can be n number of instances of this field of course with different ID but same name. In a normal PHP code I will do a <code>foreach</code> on <code>$_FILES['additional_photos']</code> and will do rest easily. But how do I achieve the same with CodeIgniter? I tried doing this:</p>
  
  <pre><code>        $additional_photosCount = count($_FILES['additional_photos']['name']); //Is there a better way to refer $_FILES like I can refere $_POST in CI?
          for($i=0; $i&lt; $additional_photosCount; $i++){
              $uploadConfig['file_name'] = $this-&gt;properties['userId'].'-'.$_FILES['additional_photos']['name'][$i];
              $this-&gt;CI-&gt;upload-&gt;initialize($uploadConfig);
              if(!$this-&gt;CI-&gt;upload-&gt;do_upload('additional_photos['.$i.']')){;
                  echo $this-&gt;CI-&gt;upload-&gt;display_errors();
              }
          }
  </code></pre>
  
  <p>But this,<br>
  a) IMHO, isn't correct way<br>
  b) gives me error "You did not select a file to upload."<br>
  <strong>Update</strong><br>
  This is a way out I could apply:</p>
  
  <pre><code>        $additional_photosCount = count($_FILES['additional_photos']['name']);
          for($i=0; $i&lt; $additional_photosCount; $i++){
              $uploadConfig['file_name'] = $this-&gt;properties['userId'].'-'.$_FILES['additional_photos']['name'][$i];
              $this-&gt;CI-&gt;upload-&gt;initialize($uploadConfig);
              $_FILES['additional_photos_'.$i] = array(
                  'tmp_name'=&gt; $_FILES['additional_photos']['tmp_name'][$i],
                  'name'=&gt; $_FILES['additional_photos']['name'][$i],
                  'type'=&gt; $_FILES['additional_photos']['type'][$i],
                  'size'=&gt; $_FILES['additional_photos']['size'][$i],
                  'error'=&gt; $_FILES['additional_photos']['error'][$i],
              );
              if(!$this-&gt;CI-&gt;upload-&gt;do_upload('additional_photos_'.$i)){;
                  echo $this-&gt;CI-&gt;upload-&gt;display_errors();//TODO: instead of echoing push errors to a list
              }
          }
  </code></pre>