I've been working for some time to create the correct headers to allow for several different kinds of file downloads from a mysql table.
I thought I had the correct headers but when trying to download one of the files that happened to be an mp3, IE is cutting the mp3 short and just playing nothing for the remainder of the file...well, more like a faint 'hiss'. I know the entire file is in the table because if I use 'save as' and then play it in windows media player, the entire file is there. Mozilla/Netscape 6 will spawn winamp and play the entire file no problem.
Here is the code that gets the file and its type, and name from the mysql table and then prints the headers. This code is in a completey different script than the one that calls it, and this code is the only code in that script.
include("config.php");
$query="select * from files where file_id = \"$file_id\"";
$result=mysql_query($query);
$assoc = mysql_fetch_assoc($result);
header("Content-type:".$assoc["type"]."");
header("Content-Disposition: attachment; filename=\"".$assoc["name"]."\"");
header("Content-Description:PHP Generated Data");
print $assoc["file"];
$assoc["type"] comes from the initial upload of the file by the user as it is contained in $HTTP_POST_FILES and so does $assoc["name"], and $assoc["file"] is the binary data.
I also noticed that when trying this for a PDF, mozilla spawns adobe acrobat reader, but IE says 'Internet Explorer was unable to open this site...it's unavailable or cannot be found...try later'.
So, I dont know for sure if this is a header issue, or what. I know it took some time to get some headers that worked properly so that makes me wonder if the ones above are causing issues with IE. Any suggestions would be much appreciated.