That did it, thanks...

Ok, my knowledge about HTTP is not the best. But how can you send three
different content-type headers? :)


-----Original Message-----
From: Barry [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 14, 2006 8:36 PM
To: php-general@lists.php.net
Subject: [PHP] Re: Setting headers for file download

Peter Lauri schrieb:
> Best group member,
> 
> This is how I try to push files to download using headers:
> 
> header("Content-type: $file_type");
> header("Content-Disposition: attachment; filename=$filename"); 
> print $file;
> 
> It works fine in FireFox, but not that good in IE. I have been googled to
> find the fix for IE, but I can not find it. Anyone with experience of
this?
> 
> Best regards,
> Peter Lauri

There ya go:
// fix for IE catching or PHP bug issue
        header("Pragma: public");
        header("Expires: 0"); // set expiration time
         header("Cache-Control: must-revalidate, post-check=0, 
pre-check=0");
         // browser must download file from server instead of cache

         // force download dialog
         header("Content-Type: application/force-download");
         header("Content-Type: application/octet-stream");
         header("Content-Type: application/download");

         // use the Content-Disposition header to supply a recommended 
filename and
         // force the browser to display the save dialog.
         header("Content-Disposition: attachment; filename=".$path.";");

         header("Content-Transfer-Encoding: binary");

         header("Content-Length: ".filesize($file));

         readfile($file);

-- 
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to