download header issue
| From: | Greg Donald | Date: | Thu, 27 Sep 2001 15:18:33 +0000 |
| Subject: | download header issue | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-69012@lists.php.net to get a copy of this message | ||
I have some code for a download script:
<?
$filename = "source";
$ext = "tar.gz";
$mime_type = "application/x-tar-gz";
$filepath = "/path/to/src";
$fullfile = $filepath . "/" . $filename . "." . $ext;
header("Content-Type: " . $mime_type);
header("Content-Disposition: attachment; filename=" . $filename . "." .
$ext);
header("Content-Description: " . $filename);
header("Pragma: no-cache");
header("Expires: 0");
readfile($fullfile);
exit();
?>
It works fine in both versions of Netscape I have tried, 4.76 and 6.1.
But IE wants to rename the file by adding a [0] or a [1] into the
filename so I end up with "source[0].tar.gz" or source[1].tar.gz as a
suggested filename. If you keep trying the download the numbers go on up
to [2] or [3] or [4] like it's incrementing or something. This even
occurs if you cancel the download, so I'm pretty sure nothing is being
cached.
What do I need to change in my script to keep IE from doing this renaming
thing?
Thanks,
Greg