title: multiple image upload with codeigniter
body: <p>i am trying to do multiple image upload with different file input with the following code</p>
  
  <pre><code>&lt;input name="attachement[]" type="file"&gt;
  &lt;input name="attachement[]" type="file"&gt;
  </code></pre>
  
  <p>My codeigniter code is</p>
  
  <pre><code>$config = array(
                  'upload_path' =&gt; $path,
                  'max_size' =&gt; 1024 * 100,
                  'allowed_types' =&gt; 'gif|jpeg|jpg|png',
                  'overwrite' =&gt; true,
                  'remove_spaces' =&gt; true);
              $images = array();
              $this-&gt;load-&gt;library('upload');
  
              $files = $_FILES;
              $count = count($_FILES[$attachName]['name']);
  
  
              for ($i = 0; $i &lt; $count; $i++) {
  
                  $_FILES[$attachName]['name'] = $files[$attachName]['name'][$i];
                  $_FILES[$attachName]['type'] = $files[$attachName]['type'][$i];
                  $_FILES[$attachName]['tmp_name'] = $files[$attachName]['tmp_name'][$i];
                  $_FILES[$attachName]['error'] = $files[$attachName]['error'][$i];
                  $_FILES[$attachName]['size'] = $files[$attachName]['size'][$i];
  
                  $fileName = $title . '_' . $_FILES[$attachName]['name'];
                  $images[] = $fileName;
                  $config['file_name'] = $fileName;
  
                  $this-&gt;upload-&gt;initialize($config);
                  $this-&gt;upload-&gt;do_upload();
                  if ($this-&gt;upload-&gt;do_upload()) {
                      $return['data'][] = $this-&gt;upload-&gt;data();
                      $return['status'] = "success";
                      $return['msg'] = sprintf($this-&gt;lang-&gt;line('success_item_added'), "Image", "uploaded");
                  } else {
                      $return['status'] = 'danger';
                      $return['msg'] .= $this-&gt;upload-&gt;display_errors('', '') . "\r";
                  }
  
              }
  </code></pre>
  
  <p>In the code above $attachName="attachement"</p>
  
  <p>But i get error <code>You did not select any file to upload</code></p>
  
  <p>what am i doing wrong?</p>