title: Open a file in the browser served from PHP
body: <p>Simple question, probably been asked a million times but I've searched and am no closer to getting this to work.</p>
  
  <p>I have a PHP script within the UserFrosting framework that serves a file to the user via their browser.  I would like the file to open in their browser if they select 'Open' insteand of download.</p>
  
  <p>Problem is, the only things that are opening properly are text files. Anything else (PDFs and JPGs tested so far) are just opening as a page of ASCII/garbled code instead of being interpreted as a PDF or an image.</p>
  
  <p>Here's the code I'm using:</p>
  
  <pre><code>header('Content-Type: '. $mime);
  header('Content-Length: ' . filesize($diskname));
  header('Content-Disposition: inline; filename=' . $savename);
  return readfile($diskname);
  </code></pre>
  
  <p><code>$mime</code> is the Mime type of the file set via a function, so could be <code>application/pdf</code> or <code>image/jpeg</code> for the files I'm trying to view so far.</p>
  
  <p>Does anyone have any ideas why the files aren't opening properly?</p>
  
  <p><strong>UPDATE</strong>
  Having checked the response headers, I'm getting a Content Type of <code>text/html;charset=UTF-8</code> instead of the <code>application/jpeg</code> or <code>application/pdf</code> that it should have been set to according to the code I'm using.  I'm wondering if this is a UserFrosting issue?</p>