header("Content-type: text/xml");
header("Content-Disposition: attachment; filename=".basename($file_name));
$maxage = 60 * 60 * 24 * 30; // number of seconds to cache page - last number is days only change this number
header('Last-Modified: '. gmdate ('D, d M Y H:i:s') . ' GMT'); // when page was last modified change to gmdate ('D, d M Y H:i:s',timestamp) to specify date
header('Cache-Control: max-age='.$maxage.', must-revalidate'); // number of seconds before page should be reloaded
$expire=gmdate('D, d M Y H:i:s',time()+$maxage); //Greenwich Mean Time
header('Expires: '.$expire. ' GMT'); // when the cache expires
header('ETag: '.time()); // browser checks this agains info in chached file
print $data;
<!-- Saved as "audio.php" for this example -->
<?php
header('Content-disposition: attachment; filename=URL/Filename.mp3');
header('Content-type: audio/mp3');
readfile('URL/Filename.mp3');
?>
<a href="URL/audio.php" style="text-decoration:none;"><button>Download Now</button></a>
If your links to the files such as audio.php?mp3=gangsta.mp3 make sure you check the input so that you do not allow people to download your php files or worse.
<form method=link" action="URL/audio.php">
<input type="button" value="Download Now">
</FORM>
<input type="button" value="Download Now" onClick="window.location.href='URL/audio.mp3'">
If your audio.php is always going to send the user one and only one file then you won't need to pass a parameter telling it what file the user wants.