Basename For Dir
<pre><code>$f = $_GET['f'];
//f = filename i.e file.mp3
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($f));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($f));
ob_clean();
flush();
</code></pre>

<p>This code works if i have all the mp3 files stored in the root directory but it doesn't if I store them in a separate folder such as /files</p>

<p>I have tried changing the basename and adding a path to <code>$f</code> but no luck</p>

<p>Is there a way i can have this code download the files from a dir instead of root?</p>
