Monday, May 24, 2010

Install mp3 files on host monster mysql datebase so php retrieves it, sends it to flash?

I just joined host monster and i am trying to figure out how i am going to put mp3 files in the mysql database that host monster provides. After doing that i want to write a php code that retrieves the mp3 or music files and send it to flash. Can someone help out please.

Install mp3 files on host monster mysql datebase so php retrieves it, sends it to flash?
Hi,





the easiest solution would be to read the mp3 binary and then store it in a longtext/blob column in a database. I recommend having two tables where you store your information: first being just blobs with blob_id, blob_data, blob_timestamp and blob_active, second containg all the mp3 info such as artist, blob_id (important), file_size, if you're only dealing with with mp3s you shouldn't need file_size nor file_type (all can be retrieved by PHP when reading the file), timestamp never did any harm...





To retrieve it you perform a simple SELECT from both tables based on blob_id (such as 'SELECT b.blob_data, m.mp3_name, m.mp3_size FROM blobs as b, mp3s as m WHERE m.mp3_id = 'HOWEVER YOU PASS THE MP3_ID here (GET I SUPPOSE)' AND m.blob_id = b.blob_id) and using headers output the mp3 to browser either to download or play (attachment/inline).





This should give you enough information to be able to browse the internet for the rest, this simple is an outline of the approach I have been taking so far (and I store all sorts: office documents, images... actually I run a DMS (Document Management System))...





Give me a shout if you need more help,


good luck,


hoopyfrood


--------------------------------------...


Love your documents!


DocuView (http://docuview.co.uk/) - The best Web 2.0 document management system (DMS) - utilising the latest technology to help your company achieve ISO 9001 certification.


No comments:

Post a Comment