title: PHP file uploading file error
body: <p>I'm trying to upload a image file using php. I'm using a simple file uploading code like on www.w3schools.com/php/php_file_upload.asp, however sometimes the php file fails to upload the images,</p>
  
  <p>The images are not that large. One is just 130kb in size, the uploading process goes up to 48% fine, then slows down reaches 72% after a long time and gives me an error "Incomplete request". Is there any way to fix this thanks.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Code :</p>
  
  <pre><code>$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; 2000000)
  &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";
    }
  </code></pre>