title: How do I find the MIME type of a file with PHP?
body: <p>I have an <em>index.php</em> file which has to process many different file types. How do I guess the filetype based on the <code>REQUEST_URI</code>?</p>
  <p>If I request <code>http://site/image.jpg</code>, and all requests redirect through <em>index.php</em>, which looks like this</p>
  <pre><code>&lt;?php
     include('/www/site'.$_SERVER['REQUEST_URI']);
  ?&gt;
  </code></pre>
  <p>How would I make that work correctly?</p>
  <p>Should I test based on the extension of the file requested, or is there a way to get the filetype?</p>