Preserving MP3 Header Info In PHP download

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mich Romney & De Shriners
    New Member
    • Mar 2006
    • 2

    #1

    Preserving MP3 Header Info In PHP download

    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("Conten t-type: application/force-download")."\n" ;
    $data1 .=header("Conte nt-type: audio/mpeg;\r\n");
    $data1 .=header("Conte nt-Disposition: attachment; filename=\"".$t itle."\"")."\n" ;
    $data1 .=header('Conte nt-Transfer-Encoding: binary');
    $data1 .=header("Conte nt-Length: ".strlen($d)."" )."\n";
    $data2 = $data1.trim($da ta0);
    echo$data2;


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

    Any thoughts?
  • Mich Romney & De Shriners
    New Member
    • Mar 2006
    • 2

    #2
    For anyone who cares, I figured it out.

    Just remove the line breaks... \n

    Duh.

    Comment

    Working...