title: php script is not uploading image to specified folder
body: <p>although I know that is has been everywhere as a question, I can't find the reason it doesn't work:</p>
  
  <p>I have gathered the code below to achieve image uploading to my site:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
  &lt;form action="insert.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>and the insert.php is:</p>
  
  <pre><code>&lt;?php
  $allowedExts = array("gif", "jpeg", "jpg", "png");
  $temp = explode(".", $_FILES["file"]["name"]);
  $extension = end($temp);
  if ((($_FILES["file"]["type"] == "image/gif")
  || ($_FILES["file"]["type"] == "image/jpeg")
  || ($_FILES["file"]["type"] == "image/jpg")
  || ($_FILES["file"]["type"] == "image/pjpeg")
  || ($_FILES["file"]["type"] == "image/x-png")
  || ($_FILES["file"]["type"] == "image/png"))
  &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("/httpdocs/" . $_FILES["file"]["name"]))
        {
        echo $_FILES["file"]["name"] . " already exists. ";
        }
      else
        {
        move_uploaded_file($_FILES["file"]["tmp_name"],
        "/httpdocs/" . $_FILES["file"]["name"]);
        echo "Stored in: " . "/httpdocs/" . $_FILES["file"]["name"];
        }
      }
    }
  else
    {
       echo "Invalid file";
    }
  ?&gt;
  </code></pre>
  
  <p>Well,the success messages are displayed correctly. However, no file is uploaded to the specified folder. </p>
  
  <p>Any thoughts?</p>