I am having two errors using the Content-Disposition header to force a file download, one involing IE and the other involving Netscape.
1 - IE 6.0 (maybe others?)
First of all, i am pretty sure my use of the headers is correct because everything works normally most of the time. The problem arises when I cancel a download. If I complete the file download then everything functions normally. If I cancel one file download everything functions normally. Then if I cancel another file download everything goes haywire. I can no longer run any php scripts. I can access plain html files normally, but if I try to access ANY php file the browser stalls for a few min until it times out. I can then close the browser window and reopen it and everything is back to normal. Everything just described is without making any calls to session_start().
To make things even stranger if I do make a call to session_start() (because I need to eventually) the error is slightly different. Namely, everything functions normally if the downloads complete, but if I cancel a single download I can no longer access php files.
None of this happens in Netscape. I can cancel 100 dowloads and it will never lock up the php scripts.
I access the file as http://domain/test.php
important code in test.php -
header("Content-type: audio/mp3\n");
header("Content-Disposition: attachment; filename=".$file."\n");
header("Content-length: ".filesize($filename)."\n");
$fp = fopen($filename, 'rb');
while(!feof($fp)) {
print fread($fp, 4096); }
fclose($fp);
NOTE ** I have tried using fpassthru and readfile as well
2 - NS 6.2 (maybe others?)
This one is even odder I think... I want to stream the mp3's through a g2 server so I access the same file above as rtsp://domain/test.php, so I get the synchronous timing. This works perfectly fine in IE. On Netscape, however, it replaces all the /'s with \'s in the URL it sends to Real Player (ie. I get an error in Real Player that says "cannot find rtsp:\domain\test.php"). Strange...
I really hope someone has any clue as to why these errors might be occuring because I am at a wall here. My site is hosted using 'Apache Version 1.3.26' and 'PHP Version 4.2.1' on Linux.
-Chris Hawkins