By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,711 Members | 2,158 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,711 IT Pros & Developers. It's quick & easy.

Preserving MP3 Header Info In PHP download

P: 2
I have created an MP3 download app from mysql. It plays the song fine. :)

Only problem is that when it downloads, all the header information, like song lyrics, credits and album cover have all disappeared. :mad: When I open the file in a text editor, the information is there, but there's lots of whitespace between it and the top of the file. Here' my php header stuff, data0 is the file data.

$data0 = base64_decode($d);
//$data1 =header("Content-type: application/force-download")."\n";
$data1 .=header("Content-type: audio/mpeg;\r\n");
$data1 .=header("Content-Disposition: attachment; filename=\"".$title."\"")."\n";
$data1 .=header('Content-Transfer-Encoding: binary');
$data1 .=header("Content-Length: ".strlen($d)."")."\n";
$data2 = $data1.trim($data0);

How do I preserve the header info so that it is recognizable by mp3 players? :confused:

Any thoughts?
Mar 24 '06 #1
Share this Question
Share on Google+
1 Reply

P: 2
For anyone who cares, I figured it out.

Just remove the line breaks... \n

Mar 25 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.