title: Multi-upload in PHP
body: <p>I am trying to upload 2 files, the first one is a flash (.swf) file and the second a .png.</p>
  
  <p>At the moment, I would have no problem making 2 different php upload file, with 2 different forms, but Im sure there can be a way to make that all together.</p>
  
  <p>I am not really experimented with PHP, but Im trying to learn.</p>
  
  <p>At the moment I have this:</p>
  
  <pre><code>&lt;?php
        $allowed_filetypes = array('.swf','.png');
        $max_filesize = 10524288;
        $upload_path = 'swf/';
  
     $filename = $_FILES['userfile']['name'];
     $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
  
     if(!in_array($ext,$allowed_filetypes))
        die('The file you attempted to upload is not allowed.');
  
     if(filesize($_FILES['userfile']['tmp_name']) &gt; $max_filesize)
        die('The file you attempted to upload is too large.');
  
     if(move_uploaded_file($_FILES['swf']['tmp_name'],$upload_path . $filename))
           echo 'Your file upload was successful, view the file &lt;a href="' . $upload_path . $filename . '" title="Your File"&gt;here&lt;/a&gt;';
        else
           echo 'An unknown error occured, try again.';
  
  ?&gt;
  </code></pre>
  
  <p>Ok so this is part of the code I found online, with that Im using a simple upload form.</p>
  
  <p>How could I go and put 2 forms on the same page, and the 2 forms upload separately to 2 different folders, in example .png goes to icons/ folder and .swf goes to swf/ folder?</p>
  
  <p>All that with only one button, that will also post other stuff.</p>