title: PHP file opens in browser instead of running
body: <p>I need a bit of PHP in a website I am building for a school project. I need it to upload .swf files. But when I press the "upload" button, it opens up the php file in the browser rather than running it, or displaying an error if there is one.</p>
  
  <p>This is my HTML code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;New Smallcut&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;font face="verdana" size="2"&gt;
  &lt;div style="text-align:center"&gt;
  This is a webpage&lt;br&gt;
  But no matter what, I am King
  &lt;p&gt;&lt;a href=http://www.kiaye.org/&gt;KIAYEorg&lt;/a&gt;&lt;/p&gt;
      &lt;br&gt;
      &lt;img src=KingSn0w.png width="100" height="100" alt=“King Sn0wCh1ld’s logo”&gt;
  
  
      &lt;form action="upload.php" method="post" enctype="multipart/form-data"&gt;
          Select game to upload:
          &lt;input type="file" name="fileToUpload" id="fileToUpload"&gt;
          &lt;input type="submit" value="Upload Image" name="submit"&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  &lt;/font&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>It is supposed to put a bit of text above an image and the form, on an otherwise plain webpage.</p>
  
  <p>Next is the PHP, which I got from W3Schools.</p>
  
  <pre><code>&lt;?php
  $target_dir = "uploads";
  $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
  $uploadOk = 1;
  $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
  // Check if image file is a actual image or fake image
  if(isset($_POST["submit"])) {
  $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
  if($check !== false) {
      echo "File is an image - " . $check["mime"] . ".";
      $uploadOk = 1;
  } else {
      echo "File is not an image.";
      $uploadOk = 0;
  }
  }
  
  // Check if file already exists
  if (file_exists($target_file)) {
  echo "Sorry, file already exists.";
  $uploadOk = 0;
  }
  
  // Allow certain file formats
  if($imageFileType != "swf") {
  echo "Sorry, only .swf files are allowed.";
  $uploadOk = 0;
  }
  ?&gt;
  </code></pre>
  
  <p>I have absolutely no clue why it's not working, I am just getting back into HTML after 5 years of not using it (I was 9 when I last used it), and I really need this bit of PHP (which I do not understand, for the record), to work. I will later need a bit more PHP to work for a site-wide search, and I assume, the search results and stuff, and it would be comforting if I could get this to work.</p>
  
  <p>Thanks in advance!</p>