title: PHP move_uploaded_file uploads only one file
body: <p>I'm testing uploads on 3 files on my desktop <code>test.xlsx</code>, <code>test - Copy.xlsx</code>, and <code>test - Copy (2).xlsx</code>. My PHP script is breaking at the line where my <code>move_uploaded_files</code> statement is. I get the error <code>move_uploaded_file(uploads/test - Copy.xlsx): failed to open stream: No such file or directory</code>. <strong>BUT</strong> <code>test - Copy (2).xlsx</code> is uploaded when I check my uploads folder. My PHP is as follows:</p>
  
  <pre><code>foreach($_FILES['file']['name'] as $key=&gt;$value){
      $fileName = $_FILES['file']['name'][$key];
      $fileTmpLoc = $_FILES['file']['tmp_name'][$key];
      $fileErrorMsg = $_FILES['file']['error'][$key];
      $type = $_FILES['file']['type'][$key];
      if(){
          //validation
      } else{ //if validated
          if(move_uploaded_file($fileTmpLoc, 'uploads/'.$fileName)){
            //do more stuff
          } else{
              echo "Upload failed.";
          }
      }
  }
  </code></pre>
  
  <p>The //do more stuff actually runs once for <code>test - Copy (2).xlsx</code> (the only file uploaded successfully). My JS script is below but I doubt that's the part that's breaking since when I print_r($_FILES) in PHP, all files appear in the output.</p>
  
  <pre><code>var upload = function(event){
      var file = document.getElementById('file').files;
      var data = new FormData();
      for (i=0; i&lt;file.length; i++){
          data.append('file[]', file[i]);
      }
      var request = new XMLHttpRequest();
      request.addEventListener('load', completeHandler, false);
      request.addEventListener('error', errorHandler, false);
      request.addEventListener('abort', abortHandler, false);
      request.open('POST', 'php/excel_upload_read.php');
      request.send(data);
  };
  </code></pre>
  
  <p>What am I doing wrong?</p>