PDA

View Full Version : mp3 stored in mysql


sir pannels
02-13-2006, 01:06 PM
Morning people :)

I have mp3's stored in a mysql database, though i have no idea how to get them out :)
How do I make them downloadable? I have done this before with images using something like this ..


list($name, $type, $size, $content) = mysql_fetch_array($result);

header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: attachment; filename=$name");
echo $content;


However not sure how to do it for mp3 files.
Any pointers would be great.
Thanks,
Sir P

slushy77
02-13-2006, 09:46 PM
hey Sir Panels,
if your technique works for images, it should work for mp3's. It may be useful to create some queries based on id3 tags (search by artist, genre etc). Use the php-id3 library to extract this info from the mp3s as you load them into DB and store as seperate values.

looks like a fun project

sir pannels
03-02-2006, 05:51 PM
Thanks Slushy :)

Yeah I have been using that now and it works ok, though it needs to be on its an entirely new page due to setting the content, so I have used a popup, this is not ideal really, plus mozila users advised troubles downloading.

This will work, however any other solutions for me to look at aswell?

It is a fun project slushy, il tell you more if your interest :)