Generate header dynamically to display requested file
<p>I have a folder with many files of different types. I need to display any requested file, so the header has to be adapted accordingly. What I tried is:</p>

<pre><code>header( 'Content-Type: ' . filetype( 'files/' . $file ) );

readfile( 'files/' . $file );
</code></pre>

<p>It works for JPG, PNG and GIF files, but for some reason MP3 files already crash the browser, so I suppose it doesn't work for every file type. Is there something wrong with the approach, or the code? How would you do it? Thanks!</p>
