I'm trying to route all my MP3 requests through a brief PHP script to log the downloads to a database, and then I want to output the MP3 exactly as if the browser had requested it normally. So far I haven't found headers that will serve it normally; it either wants to download it as an attachment or an application. I want the browsers to treat it however they normally treat MP3's, usually playing in the browser window. Here's what I'm doing:

(my MP3 files are all named podcast-xxxx.mp3) where $id is the xxx:

header('Content-Type: application/octet-stream');               
header('Content-Disposition: attachment; filename=podcast-'.$id.'.mp3');
$size = filesize('audio/podcast-'.$id.'.mp3');
header('Content-Length: '.$size);
readfile('audio/podcast-'.$id.'.mp3');

What should I change?

- Brian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to