title: Upload DOC or PDF using PHP
body: <p>I'm able to upload images fine, but when when I change the types from image/jpg, image/gif to application/msword and application/pdf, it doesn't work. Here's my code. The exact same code works for images, but for uploading docs and pdf, it outputs "Invalid File." What's going on here? My file is only approx 30kb and is well under the file size limit here.</p>
  
  <pre><code>$allowedExts = array("pdf", "doc", "docx"); 
  $extension = end(explode(".", $_FILES["file"]["name"]));
  
  if ( ( ($_FILES["file"]["type"] == "application/msword") || ($_FILES["file"]["type"] == "text/pdf") ) 
  &amp;&amp; ($_FILES["file"]["size"] &lt; 20000) &amp;&amp; in_array($extension, $allowedExts))
  {      
   move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); 
  }
  else
  {
  echo "Invalid file."
  }
  </code></pre>