title: List of file types php
body: <p>I'm looking for a list/description detailing the file type <code>php</code> assigns based on an uploaded file.</p>
  
  <p>I have the following script. It takes the uploaded file, and the file type. Compares it to the array to check if the type is allowed and then proceeds with the script.</p>
  
  <pre><code>$file  = $_FILES['attachment']['tmp_name'];
  
  //check file is correct type
  $fileType = $_FILES['attachment']['type'];
  // array of allowed file extensions
  $fileTypeArray = ["application/pdf", "application/doc", "application/docx", "application/rtf", "application/txt", "application/odf", "application/msword"];
  
  
  // now check that the file type matches that of the array. 
  if (!in_array($fileType, $fileTypeArray)){ 
  </code></pre>
  
  <p>I would like to allow the upload of any <code>doc</code>, <code>pdf</code>, <code>txt</code>, etc.  Its purpose is to handle uploaded cv's. Please tell me if you can think of a better solution. Cheers!</p>