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 ?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.