After much hairpulling, I have suceeded in getting IE 6 to show a file download box and show a file for me. The code I used is as follows:
$filename = "backup".gmdate("YMdHi").".sql.gz";
header("Expires: Mon, 26 Jul 2001 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Cache-control: private");
header("Content-Type: application/x-gzip" );
header("Content-Disposition: attachment; filename=$filename");
$fd = popen("mysqldump -u $dbuser -p$password $dbname | gzip", 'r');
if ($fd !== FALSE) {
while(!feof($fd)) {
echo fgets($fd);
}
pclose($fd);
}
The only thing is in say Firefox, the downloaded file is called
backup2004Jun020858.sql.gz
whereas IE always asks me to save a file called
backup2004Jun020858[1].sql.gz
with the [1] even though there is no existing file of this name. grr!