title: PHP Handle Multiple File Uploads EASY
body: <p><em><strong>SOLVED!</em></strong> Used this example from php.net post method handling multiple uploads, with the knowledge gained by using andre's answer which is why I selected it as the answer, here it goes!</p>
  
  <pre><code>foreach ($_FILES["userfile"]["error"] as $key =&gt; $error) {
  if ($error == UPLOAD_ERR_OK) {
    if ($x=="0"){
      $data=explode(".",$_FILES["userfile"]["name"][$key]);
      $named=$id[id].".".$data[1];
      $x=$x+1;
      }else{
      $data=explode(".",$_FILES["userfile"]["name"][$key]);
      $named=$id[id]."-".$x.".".$data[1];
      $x=$x+1;
      }
      $uploaddir = '/home/content/92/8498392/html/items/'.$_POST[catid];
      $tmp_name = $_FILES["userfile"]["tmp_name"][$key];
      move_uploaded_file($tmp_name, "$uploaddir/$named");
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The result is the first image is uploaded as 45.jpg, the second is uploaded as 45-1.jpg and so forth! Thanks for the help guys :D</p>