title: php upload multiple files
body: <p>Im not super familiar with PHP, I have the following code which allows me to upload a file to the server. how can I make this upload multiple files, in my html I have already added the multiple property. the php code is this:</p>
  
  <pre><code>&lt;?php
  session_start();
  $allowedExts = array("jpg", "jpeg", "gif", "png");
  $extension = end(explode(".", $_FILES["file"]["name"]));
  
  if ((($_FILES["file"]["type"] == "image/gif")
  || ($_FILES["file"]["type"] == "image/jpeg")
  || ($_FILES["file"]["type"] == "image/png")
  || ($_FILES["file"]["type"] == "image/pjpeg"))
  &amp;&amp; ($_FILES["file"]["size"] &lt; 20000)
  &amp;&amp; in_array($extension, $allowedExts))
    {
    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;";
  
  if (file_exists($_SESSION['user']."/" . $_FILES["file"]["name"]))
    {
    echo $_FILES["file"]["name"] . " already exists. ";
    }
  else
    {
    move_uploaded_file($_FILES["file"]["tmp_name"][$i],
    $_SESSION['user']."/" . $_FILES["file"]["name"]);
    echo "Stored in: " . $_SESSION['user']."/" . $_FILES["file"]["name"];
  
    }
  }
  
  
  
  else
    {
    echo "Invalid file";
    }
  </code></pre>
  
  <p>?></p>