Hi,
I know there have been alot of posts on this subject... and I probably have read most of them.
Ive got this script (look below) that works beatifully in 95% of all cases.
The problem is that my client is using a browser that's with the other 5%...
He's using Internet Explorer 5.00.2314.1003 on NT4 SP6.
The script works, it forces the download, problem is that when he downloads a PDF-file he gets 2 boxes asking him what he wants to do with the file.
The machine I'm working on has IE 5.00.3315.1000 on it and I don't have the problem.
This is my last chance... otherwise I'll have to start thinking on a way how to tell him it just isn't possible.
Thanx,
Bert
<?
$what_to_get = getenv("QUERY_STRING");
$filename= basename($what_to_get);
//this is the only way all versions of netscape download the file
$mime='application/octet-stream';
$filesize=filesize("/path/to/the/file/folder/download/$what_to_get");
//IE 5.5 doesn't like cont.disp. with "attachment"
if(preg_match("/MSIE 5.5/", $HTTP_USER_AGENT)) {header("Content-Disposition: filename=$filename");}
else {header("Content-Disposition: attachment; filename=$filename");}
header("Content-Type: $mime");
header("Content-Length: $filesize");
header ("Content-Transfer-Encoding: binary");
$fh = fopen("/path/to/the/file/folder/download/$what_to_get", "r");
fpassthru($fh);
?>