title: PHP upload MIME type restrictions
body: <p>I have a file upload system in a site which allows upload of .doc, .docs and .pdf files. Currently the PHP script allows upload of any file type. I would like to restrict it to only allow uploading of genuine PDF DOC and DOCX files. I have read that this is best done via checking the MIME type / headers of the file - but cant seem to find an agreed best solution to do this anywhere. </p>
  
  <p>Any tips on the best way to achieve this?</p>
  
  <p>Current upload PHP is:</p>
  
  <pre><code>$meta = $dropbox-&gt;UploadFile($_FILES["fileInputFieldName"]["tmp_name"], $upload_name);
  </code></pre>
  
  <p>Appreciate any tips on how to integrate this into the suggestions please.</p>