title: Counting the number of uploaded files
body: <p>I am working on my CodeIgniter project, and it is so far working very well.</p>
  
  <p>However, I need some way to count the number of uploaded files, since I want to limit it in some cases (but not all).</p>
  
  <p>How can I do that? I tried <code>count($_FILES)</code> but that gave me nothing usable.</p>
  
  <p>I also tried a bunch of other things, but neither gave me the information I need.</p>
  
  <p>The upload form is a multiple file upload, and I am using <a href="https://github.com/stvnthomas/CodeIgniter-2.1-Multi-Upload" rel="nofollow">this</a> library to handle multiple uploads.</p>
  
  <p>The upload function without the counting looks like this:</p>
  
  <pre><code>function do_upload()
  {
      $setid = $this-&gt;input-&gt;post('imageset');
          $this-&gt;load-&gt;library('upload');
          $this-&gt;load-&gt;library('image_lib');
          $this-&gt;upload-&gt;initialize(array(
                  "upload_path"   =&gt; "./photos/",
                  "allowed_types" =&gt; "jpg|jpeg|png|gif",
                  "encrypt_name" =&gt; TRUE
          ));
          try {
              $this-&gt;upload-&gt;do_multi_upload("files");
              $images = $this-&gt;upload-&gt;get_multi_upload_data();
              $config = array(
                      'image_library'  =&gt; 'gd2',
                      'create_thumb'   =&gt; TRUE,
                      'maintain_ratio' =&gt; TRUE,
                      'width'          =&gt; '145',
                      'height'         =&gt; '145'
              );
              foreach ($images as $image)
              {
                  $config['source_image'] = $image['full_path'];
                  $this-&gt;image_lib-&gt;initialize($config);
                  $this-&gt;image_lib-&gt;resize();
                  $this-&gt;manage_model-&gt;insertimage($image['file_name'],$image['orig_name'],$image['file_size'],$image['file_type'],$setid);
              }
              $this-&gt;session-&gt;set_flashdata('success','Billederne er nu blevet uploadet.');
          } catch (Exception $e) {
              $this-&gt;session-&gt;set_flashdata('error', $e);
          }
          redirect('manage/images','refresh');
  }
  </code></pre>
  
  <p>Any help is very appreciated.</p>