Jump to content

Using an audio file thats stored as a LongBlob


cdoggg94

Recommended Posts

I really like how Blob and Long blob handle pictures so I decided to try it with audio...I can get the file to upload fine but my problem using the file once its in the database...

 

This is kind of what I am doing.

 

This is my file called get_audio.php:

 

<?php
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("my_db") or die(mysql_error());

$id = addslashes($_REQUEST['id']);

$audio = mysql_query("SELECT* FROM wineAudio_tbl WHERE audio_id=$id");
$audio = mysql_fetch_assoc($audio);
$audio = $audio['audioFile'];

header("Content-type: audio/mp3");

echo $audio;

?>

 

When I want to use the audio I would just have a link something like this:

 

<a href="get_audio.php?id=12" target="_blank">Play Audio</a>

 

When you click on the "Play Audio" button it opens a browser mp3 player, but does not start the file..

 

Any ideas what I could be doing wrong ?

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.