Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

play audio files

Status
Not open for further replies.

molly2ka

Programmer
Mar 20, 2004
27
US
Hi,

I'm using php 4.3.2 with mysql 4.0.13 to create a database system. I'm not sure if this is a php or mysql ques so i'm posting it on both forums(therefore i apologise if you've already read this).I'm storing short audio files(10-15 seconds) in a database and I'd like the user to be able to play these files from the database. Has anyone have any idea how to do this??? By the way I'll be running the system on a linux environment. I've tried file uploads to insert the audio in but it doesn't seem to work so at the moment the user manually types in the path of the audio file and it is stored through that.

Many thanks,

Manni
 
You don't play the audio files from PHP. PHP runs on the server -- playing audio files on the server would not be very useful to your users.

What you would do is provide a page with links to to a PHP script of the form "<a href="yourscript.php?id=somenumber>...</a>". "yourscript.php" will, when given an ID, output the appropriate content-type headers, fetch a audio record from the database and stream the record to the browser. The browser will handle playing the audio.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top