title: False MIME type detection in PHP
body: <p>I have this code:</p>
  
  <pre><code>&lt;?php
      if (isset($_POST)) {
          $finfo = finfo_open(FILEINFO_MIME_TYPE);
          $fileMime = finfo_file($finfo, $_FILES["file"]["tmp_name"]);
          finfo_close($finfo);
          echo $fileMime;
      }
  ?&gt;
  &lt;form method="post" enctype="multipart/form-data"&gt;
      &lt;input type="file" name="file"&gt;
      &lt;button type="submit"&gt;Upload&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And in some cases, people have managed to fake the MIME type, it was a a .php file with application/octet-stream and the script detected it as image/jpeg.</p>
  
  <p>Is there any way to fix this and detect the correct MIME type?</p>
  
  <p>Thanks!</p>