title: how to upload doc and docx in php?
body: <p>Am trying to upload document and docx in php through html input but am unable to upload doc and docx even i mentioned the mime type correctly.please help me out to upload doc and docx.i wrote my code above..thanks in advance..            </p>
  
  <pre><code>&lt;?php
  
  $allowedExts = array(".doc", ".docx", "pdf", "gif", "jpeg", "jpg", "png");
  $extension = end(explode(".", $_FILES["file"]["name"]));
  if (($_FILES["file"]["type"] == "application/pdf")
  || ($_FILES["file"]["type"] == "image/gif")
  || ($_FILES["file"]["type"] == "image/jpeg")
  || ($_FILES["file"]["type"] == "image/jpg")
  || ($_FILES["file"]["type"] == "application/msword")
  || ($_FILES["file"]["type"] == "application/msword")
  || ($_FILES["file"]["type"] == "image/pjpeg")
  || ($_FILES["file"]["type"] == "image/x-png")
  || ($_FILES["file"]["type"] == "image/png")
  &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"] / 200000) . " 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>