title: How to get the content-type of a file in PHP?
body: <p>I'm using PHP to send an email with an attachment. The attachment could be any of several different file types (pdf, txt, doc, swf, etc).</p>
  
  <p>First, the script gets the file using "file_get_contents".</p>
  
  <p>Later, the script echoes in the header:</p>
  
  <pre><code>Content-Type: &lt;?php echo $the_content_type; ?&gt;; name="&lt;?php echo $the_file_name; ?&gt;"
  </code></pre>
  
  <p>How to I set the correct value for <strong>$the_content_type</strong>?</p>