Rudimentary PHP upload script not producing desired result
<p>My goal isn't perfection right now, it's functionality. I'll add visuals and security later, but for now all I'd like to be able to do is restrict uploads to .mp3 files, and product a URL to the file after the upload.</p>

<p>Currently, PHP displays the intended echo results, but the file isn't in <code>/var/www/html/upload</code>, as it should be.</p>

<h1>HTML (The part in question, at least.)</h1>

<p>upload.html</p>

<pre><code>&lt;form action="upload_file.php" method="post" enctype="multipart/form-data"&gt;
&lt;label for="file"&gt;&lt;strong&gt;File:&lt;/strong&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;/form&gt;
</code></pre>

<h1>PHP (Every bit of it.)</h1>

<p>upload_file.php</p>

<pre><code>&lt;?php
if ($_FILES["file"]["type"] == "audio/mp3")
  {
  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("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"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }
?&gt;
</code></pre>

<h1>The PHP Result</h1>

<p>Checking <code>upload/</code>, the directory is empty.</p>

<pre><code>Upload: hintro.mp3
Type: audio/mp3
Size: 390.0947265625 kB
Temp file: /tmp/phpnMYOou
Stored in: upload/hintro.mp3
</code></pre>

<p>Any and all help is appreciated!</p>
