The funny thing is that I wrote a php media gallery for all my music 2 days ago. I had a similar problem. I am using http://musicplayer.sourceforge.net/ for the player. And the playlist is built through php. Are all music requests sent there with a script called xfer.php? File = WHATEVER
$filename = base64_url_decode($_REQUEST['file']); header("Cache-Control: public"); header('Content-disposition: attachment; filename='.basename($filename)); header("Content-Transfer-Encoding: binary"); header('Content-Length: '. filesize($filename)); // Put either file counting code here. either a db or static files // readfile($filename); //and spit the user the file function base64_url_decode($input) { return base64_decode(strtr($input, '-_,', '+/=')); }
And when you call the files, use something like:
function base64_url_encode($input) { return strtr(base64_encode($input), '+/=', '-_,'); }
http://us.php.net/manual/en/function.base64-encode.php
If you are using some kind of javascript or flash player (such as a JW player) that requires the actual link to be an mp3 file or something similar, you can add the text "& type = .mp3" so that the final the link became something like this: "www.example.com/xfer.php? file = 34842ffjfjxfh and type = .mp3." So it looks like it ends with the mp3 extension without affecting the file link.
w-ll Aug 01 '08 at 17:33 2008-08-01 17:33
source share