[ciapug] mp3 streaming to aol

Barry Von Ahsen ciapug@cialug.org
Fri, 20 Feb 2004 09:52:50 -0600


I've got a page where you can listen to an mp3 file or download a 
winzipped exe of said mp3.  Now I need to track who downloads each file. 
  So I linked to a file to do the tracking, then redirected to the file. 
  Now AOL won't stream the mp3 - it opens the player, but does nothing. 
  The exe gives the save as dialog as expected.  I'm guessing it's a 
header/content type issue.  Any ideas?  You can see my attempts below. 
When the simple redirect didn't work, I tried the content-type header, 
and when that didn't work, I tried to open the file and do a passthru

-barry

$thefile = $_GET['thefile'];
$sql = "INSERT INTO dltracker SET thefile='$thefile',dt_download=NOW()";
$rs = $db->Execute($sql);
list($name,$extension) = split("\.",$thefile);
/*switch(strtolower($extension)) {
	case "mp3": header("Content-type: audio/mpeg3\n"); break;
	case "exe": header("Content-type: application/x-executable\n"); break;
}*/
header("Content-Type: application/octet-stream");
header("Location: download/".$thefile);
exit;
//$fp = fopen($filepath."download/".$thefile,"r");
//fpassthru($fp);