Re: Setting headers for file download
| From: | Rafael | Date: | Tue, 13 Jun 2006 23:28:09 +0000 |
| Subject: | Re: Setting headers for file download | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237939@lists.php.net to get a copy of this message | ||
I use something like this...
$file_len = filesize($file_name);
$file_ts = filemtime($file_name);
header('Content-Type: application/x-octet-stream'); // none known
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Last-Modified: '. gmdate('D, d M Y H:i:s', $file_ts) .' GMT');
header('Content-Disposition: attachment; filename="'. basename($file_name) .'"');
header("Content-Length: $file_len");
readfile($file_name);
Peter Lauri wrote:
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-- Atentamente / Sincerely, J. Rafael Salazar Magaña