Jump to content

Retaining ID3 tags when sending MP3 as attachment using header()


polemios

Recommended Posts

Hi everyone. I am using a simple form where users can select a mp3. Then the form submits certain tracking info to a database and then sends the following header info to the browser:

 

header('Content-type: audio/mpeg');

header('Content-Disposition: attachment; filename="new name.mp3"');

readfile('./filename.mp3');

 

This works great for me, except for one issue. The issue is that the ID3 tags get lost when the file gets renamed. I would like to have the file retain the ID3 info.

 

One apparently simple solution would be to not rename the file, but the "Content-Disposition" seems to need a filename specified, and even if it's the same name as the file, it treats it as a renamed file. So that isn't an option, I think.

 

I have seen numerous ways of retrieving ID3 info, which it seems is mostly used for music players, but I haven't seen any way in attaching that ID3 info to the file being sent through the header() function.

 

Does anyone know how I can send my clients a file this way while the MP3 retains the ID3 tags on the users computer.

 

-Thanks

I've been scouring the web with my Mozilla Brillo pad and I still can't find any info. SO much about reading ID3 tags, but not anything about retaining them, or attaching them to mp3s send with an attachment header.

 

Should I give up?

 

Did I provide enough information here for someone to address my problem, or at least to commiserate with me?

 

haha

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.