Download script displays wrong filename
Posted: Sun Dec 07, 2003 10:14 pm
I am using this download script (audio.php) to get files from a protected folder. I am fairly new to php so I do not know how to expand on this to get it right. What it is doing is downloading the mp3 files as audio.mp3 even though the filename is different. How can I get it to download the right filename? Thanks.
This is the audio.php
and the file that links to it, uses the url http://www.example.com/media.php?id=song.mp3
Thanks again.
This is the audio.php
Code: Select all
<?php
$path="./media/"; // Path to protected directory
$mimetype="audio/mp3"; // Mime type of file
Header("Content-Type: $mimetype");
readfile ($path . $id);
?>Thanks again.