title: PHP Uploading: Uploading multiple files?
body: <p>I'm currently uploading a single file successfully with the following form: </p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
  &lt;form action="upload_file.php" method="post" enctype="multipart/form-data"&gt;
  &lt;label for="file"&gt;Filename:&lt;/label&gt;
  &lt;input type="file" name="file" id="file" /&gt; 
  
  &lt;br /&gt;
  &lt;input type="submit" name="submit" value="Submit" /&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And with the following script: </p>
  
  <pre><code>&lt;?php
  error_reporting(E_ALL);
  
  
  
      if (($_FILES["file"]["size"] &lt; 20000))
        {
        if ($_FILES["file"]["error"] &gt; 0)
          {
          echo "Return Code: " . $_FILES["file"]["error"] . "&lt;br /&gt;";
          }
        else
          {
          echo "Upload: " . $_FILES["file"]["name"] . "&lt;br /&gt;";
          echo "Type: " . $_FILES["file"]["type"] . "&lt;br /&gt;";
          echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb&lt;br /&gt;";
          echo "Temp file: " . $_FILES["file"]["tmp_name"] . "&lt;br /&gt;";
  
  
          $moved = move_uploaded_file($_FILES["file"]["tmp_name"], "C:/inetpub/wwwroot/PHP_Ramp/upload/" . $_FILES["file"]["name"]);
  
          if ($moved) {
              echo "Move: Success &lt;br/&gt;";
          }
          else {
              echo "Move Failed &lt;br/&gt;";
          }
  
  
            echo "Stored in: " . "C:/inetpub/wwwroot/PHP_Ramp/upload/" . $_FILES["file"]["name"];
            }
          }
  
      else
        {
        echo "Invalid file";
        }
      ?&gt;
  </code></pre>
  
  <p>I'm now trying to allow the user to select three different files from the form.  I've found a few guides that show how to do something similar, but I can't quite get it working.  </p>
  
  <p>I've modified the form as follows (to include three inputs): </p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
  &lt;form action="upload_file.php" method="post" enctype="multipart/form-data"&gt;
  &lt;label for="file"&gt;Filename:&lt;/label&gt;
  &lt;input type="file" name="file" id="file" /&gt; 
  &lt;input type="file" name="file" id="file" /&gt;
  &lt;input type="file" name="file" id="file" /&gt;
  &lt;br /&gt;
  &lt;input type="submit" name="submit" value="Submit" /&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But I'm not sure how to modify the php to handle all three files.  I know I need to iterate through _FILES but everything I've tried isn't working.  Any pointers would be appreciated.</p>