Why will this php file upload not work?
<p>I have been playing around with this for a while now, but simply cannot get this to upload a submitted file to the server. </p>

<p>Anyone have any ideas?       </p>

<pre><code>&lt;?php
  if ($_POST["file"]){

    $allowedExts = array("mp3", "txt");
    $extension = end(explode(".", $_FILES["file"]["name"]));

    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("upload/" . $_FILES["file"]["name"]))
    {
       echo $_FILES["file"]["name"] . " already exists. ";
    }
    else
    {
       move_uploaded_file($_FILES["file"]["tmp_name"],
                     "upload/" . $_FILES["file"]["name"]);
       echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
    }

  }
?&gt;
</code></pre>
