title: $_FILES array but only first file uploads
body: <p>I'm trying to upload multiple image files.  If the image name is "icon.jpg" then it's moved to a different place than any other images - this seems to be working ok however only the first image is uploaded and moved.</p>
  
  <p>The script stops after the first image and says "Query was empty" even though I'm trying to upload at least 4 or 5 other images.</p>
  
  <pre><code>$id = '01';
  foreach($_FILES['file']['name'] as $n =&gt; $image) 
  if(!empty($image)) {
  {
   if ($image == 'icon.jpg'){
    $target_path = "../images/articles/".$id."_small.jpg";
    } else {
    $target_path = "../images/galleries/".$id."/pk_hb" . $id.".jpg";
    }
    move_uploaded_file($_FILES['file']['tmp_name'][$n], $target_path);
  $id++;
   }
  }
  </code></pre>
  
  <p>I've included the dynamic JS upload form I'm using, in case this is the problem:</p>
  
  <pre><code>&lt;form action="&lt;? echo $_SERVER['PHP_SELF'];?&gt;" enctype="multipart/form-data" method="post" name="add"&gt;
  Image 1: &lt;input name='file[]' type='file' accept="image/*" /&gt;
  &lt;div id='file_tools'&gt;
      &lt;img src='../images/top/file_add.png' id='add_file' title='Add new input'/&gt;
      &lt;img src='../images/top/file_del.png' id='del_file' title='Delete'/&gt;
  &lt;/div&gt;
  
  &lt;script type='text/javascript'&gt;
  $(document).ready(function(){
  var counter = 2;
  $('#del_file').hide();
  $('img#add_file').click(function(){
      $('#file_tools').before('Image '+counter+': &lt;input name="file[]" type="file" accept="image/*" /&gt;');
      $('#del_file').fadeIn(0);
  counter++;
  });
  $('img#del_file').click(function(){
      if(counter==3){
          $('#del_file').hide();
      }   
      counter--;
      $('#f'+counter).remove();
  });
  });
  &lt;/script&gt;
      &lt;input class="submit" type="submit" name="add" value="Submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Added contents of var_dump($_FILES)</p>
  
  <pre><code>array(1) { 
  ["file"]=&gt; array(5) 
  { 
   ["name"]=&gt; array(1) { [0]=&gt; string(11) "cooley1.jpg" } 
   ["type"]=&gt; array(1) { [0]=&gt; string(10) "image/jpeg" } 
   ["tmp_name"]=&gt; array(1) { [0]=&gt; string(18) "/var/tmp/phpLYaj7U" } 
   ["error"]=&gt; array(1) { [0]=&gt; int(0) } 
   ["size"]=&gt; array(1) { [0]=&gt; int(106241) } 
  } 
  } 
  </code></pre>