title: Uploading file via PHP, doesn't work
body: <p>I copied the code from this page:
  <a href="http://www.w3schools.com/php/php_file_upload.asp" rel="nofollow">http://www.w3schools.com/php/php_file_upload.asp</a></p>
  
  <p>Problem is that i don't get an error when uploading a file, instead this 
  shows which should be correct:</p>
  
  <p>Upload: images.jpeg
  Type: image/jpeg
  Size: 5.8603515625 kB
  Temp file: /tmp/phpZ67YXk
  Stored in: upload/images.jpeg</p>
  
  <p>But no file is saved on the server.</p>
  
  <p>I don't know what is wrong but I'm thinking in terms of permission, still there is a folder
  named upload with 777 permissions. </p>
  
  <p>These php-files are hosted on a online web host so I don't run this locally.</p>
  
  <p>HTML-form
      
      </p>
  
  <pre><code>&lt;form action="upload_file.php" method="post"
  enctype="multipart/form-data"&gt;
  &lt;label for="file"&gt;Filename:&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;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>upload_file.php</p>
  
  <pre><code>&lt;?php
  $allowedExts = array("jpg", "jpeg", "gif", "png");
  $extension = end(explode(".", $_FILES["file"]["name"]));
  if ((($_FILES["file"]["type"] == "image/gif")
  || ($_FILES["file"]["type"] == "image/jpeg")
  || ($_FILES["file"]["type"] == "image/png")
  || ($_FILES["file"]["type"] == "image/pjpeg"))
  &amp;&amp; ($_FILES["file"]["size"] &lt; 20000)
  &amp;&amp; in_array($extension, $allowedExts))
    {
    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>