title: PHP File Uploader leading to "Page not Found"
body: <p>I've put together an HTML Form for a PHP File Uploader but when I use the form and attempt to upload the file I get sent to a "Page not Found" and the file never ends up where it's supposed to on my server. </p>
  
  <p>Here's the Form:</p>
  
  <pre><code>&lt;form action="upload_file.php" method="post" enctype="multipart/form-data"&gt;
  &lt;p&gt;&lt;font size="2"&gt;*=Required&lt;/font&gt;&lt;/p&gt;
    &lt;b&gt;Mod Name:*&lt;/b&gt;&lt;br /&gt;&lt;input type="text" name="modname" size="30"&gt;&lt;br /&gt;
    &lt;b&gt;Author:*&lt;/b&gt;&lt;br /&gt;&lt;input type="text" name="author" size="30"&gt;&lt;br /&gt;
    &lt;b&gt;Version:*&lt;/b&gt;&lt;br /&gt;&lt;input type="text" name="version" size="30"&gt;&lt;br /&gt;&lt;br /&gt;
    &lt;b&gt;Game:&lt;/b&gt;&lt;select&gt;
      &lt;option value="morrowind"&gt;Morrowind&lt;/option&gt;
      &lt;option value="oblivion"&gt;Oblivion&lt;/option&gt;
      &lt;option value="skyrim"&gt;Skyrim&lt;/option&gt;
      &lt;/select&gt;&lt;br /&gt;&lt;br /&gt;
   &lt;p&gt;&lt;b&gt;&lt;font size="3"&gt;Dependencies:&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;
    &lt;p&gt;Morrowind&lt;/p&gt;
     &lt;input type="checkbox" value="expansion" name="tribunal" /&gt;Tribunal &lt;br /&gt;
     &lt;input type="checkbox" value="expansion" name="bloodmoon" /&gt;Bloodmoon &lt;br /&gt;
     &lt;input type="checkbox" value="mod" name="mge" /&gt;MGE &lt;br /&gt;
     &lt;input type="checkbox" value="mod" name="mwe" /&gt;MWE &lt;br /&gt;
     &lt;input type="checkbox" value="mod" name="mwse" /&gt;MWSE &lt;br /&gt;
    &lt;p&gt;Oblivion&lt;/p&gt;
     &lt;input type="checkbox" value="expansion" name="knights" /&gt;Knights of the Nine &lt;br /&gt;
     &lt;input type="checkbox" value="expansion" name="isle" /&gt;Shivering Isles &lt;br /&gt;
    &lt;p&gt;Skyrim&lt;/p&gt;
     &lt;input type="checkbox" value="expansion" name="dawnguard" /&gt;Dawnguard &lt;br /&gt;&lt;br /&gt;
  &lt;label for="description"&gt;&lt;b&gt;Description:&lt;/b&gt;&lt;/label&gt;&lt;br /&gt;
   &lt;textarea id="description" rows="4" cols="50"&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;
  &lt;b&gt;Uploader Name:&lt;/b&gt;&lt;br /&gt;&lt;input type="text" name="upname" size="30"&gt;&lt;br /&gt;&lt;br /&gt;
  &lt;label&gt;&lt;b&gt;Uploader Comments&lt;/b&gt;&lt;/label&gt;&lt;br /&gt;
   &lt;textarea id="uploader" rows="4" cols="50"&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;
  &lt;b&gt;Mirror Links:&lt;/b&gt;&lt;br /&gt;&lt;input type="text" name="mirror" size="50"&gt;&lt;br /&gt;&lt;br /&gt;
  &lt;label for="file"&gt;&lt;b&gt;Upload Mod:&lt;/b&gt;&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;p&gt;&lt;font size="2"&gt;Maximum File Size: 400MB; Only Compressed Files Accepted (.zip, .rar, .7z)&lt;/font&gt;&lt;/p&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and here's the upload php file:</p>
  
  <pre><code>    &lt;?php
  $allowedExts = array("zip, rar, 7z");
  $extension = end(explode(".", $_FILES["file"]["name"]));
  if ((($_FILES["file"]["type"] == "application/zip")
  || ($_FILES["file"]["type"] == "application/x-rar-compressed")
  || ($_FILES["file"]["type"] == "application/x-7z-compressed"))
  &amp;&amp; ($_FILES["file"]["size"] &lt; 419430401)
  &amp;&amp; in_array($extension, $allowedExts))
    {
    if ($_FILES["file"]["error"] &gt; 0)
      {
      echo "Error: " . $_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"] / 400) . " Mb&lt;br /&gt;";
      echo "Stored in: " . $_FILES["file"]["tmp_name"];
  
   if (file_exists("uploads/mods/" . $_FILES["file"]["name"]))
        {
        echo $_FILES["file"]["name"] . " already exists. ";
        }
      else
        {
        move_uploaded_file($_FILES["file"]["tmp_name"],
        "uploads/mods/" . $_FILES["file"]["name"]);
        echo "Stored in: " . "uploads/mods/" . $_FILES["file"]["name"];
        }
      }
    }
  else
    {
    echo "Invalid file";
    }
  ?&gt;
  </code></pre>
  
  <p>Where did I mess up? </p>
  
  <p>Do I need to place the .php file inside of the upload directory? Where does the form information go? Also, how do I require some of the text boxes in the form?</p>
  
  <p>Thanks, I'm a bit lost here.</p>