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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MP3 Showing File Contents

Status
Not open for further replies.

DonP

IS-IT--Management
Jul 20, 2000
684
US
On an a couple MP3 files that are in a MySQL database, trying to play them simply shows the BLOB field contents. WAV files seem to play properly.

I am sending header info as:

Code:
header("Mime-version: 1.1");
header("Content-Type: " . $MimeType);
header("Content-Length: " . strlen($AudioClip)); 
header("Content-Disposition: inline; filename= " . $SampleTitle);

print $AudioClip;

These variables produce something like this:

Code:
header("Mime-version: 1.1");
header("Content-Type: audio/mpeg");
header("Content-Length: 100000")
header("Content-Disposition: inline; filename=audiofile.mp3");

print $AudioClip;

Any ideas?

Don
Experienced in HTML, Perl, PHP, VBScript, PWS, IIS and Apache and MS-Access, MS-SQL, MySQL databases
 
I don't know the answer, but my guess is that you are either mis-using the content-type, or your client(s) do not have the correct handler to deal with the content-type you've chosen.



D.E.R. Management - IT Project Management Consulting
 
That's a possibility since when I hard-code it to:

Code:
header("Content-Type: audio/mpeg");

it seems to work! Apparently it needs the closing quote:

Code:
header("Content-Type: " . $MimeType . "\"");

So simple. Thanks!

Don
Experienced in HTML, Perl, PHP, VBScript, PWS, IIS and Apache and MS-Access, MS-SQL, MySQL databases
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top