title: How to upload an array of files with CodeIgniter?
body: <p>How would I upload an array of files with CodeIgniter?  I have a form where I want users to be able to upload more than one file at a time.  I have a javascript code that adds an extra file input field named "files[]" when they click on a submit button.  This is the code I have so far, but it always says that I didn't select a file to upload in the display_errors function.  </p>
  
  <pre><code>    &lt;code&gt;
  foreach($this-&gt;input-&gt;post('files') as $i =&gt; $file){
                      $config = array(  //Preferences to validate the image before uploading it
                          'upload_path' =&gt; './attachments',
                          'allowed_types' =&gt; 'jpg|gif|bmp',
                          'max_size' =&gt; '100',
                          'max_width' =&gt; '950',
                          'max_height' =&gt; '631',
                          'overwrite' =&gt; FALSE,
                          'encrypt_name' =&gt; TRUE,
                          'remove_spaces' =&gt; TRUE
                          );
                      $this-&gt;load-&gt;library('upload', $config);
                      if($this-&gt;upload-&gt;do_upload('files['.$i.']')){
                          echo $this-&gt;upload-&gt;file_data();
                      } else {
                          echo $this-&gt;upload-&gt;display_errors('&lt;li&gt;', '&lt;/li&gt;');
                      }
              }
  &lt;/code&gt;
  </code></pre>