note 34971 added to function.header
| From: | ian at rack1 dot php dot net | Date: | Wed, 13 Aug 2003 18:49:08 +0000 |
| Subject: | note 34971 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-54099@lists.php.net to get a copy of this message | ||
Re the NS7/Mozilla bug which adds a ".php" extension to files attached in PHP:
I've found that if you specify the type of the file by using the filetype command, Mozilla (not
tested in NS7) will keep the correct filename and not add ".php" to the end.
<?php
// $file = filename
// $path = path to file
header("Content-Disposition: attachment; filename=$file");
header("Content-Length: " . filesize($path));
header("Content-Type: " . filetype($path));
readfile("$path");
?>
Tested in IE6 SP2 and Mozilla 1.4. Results are favourable in both browsers.
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34971
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34971&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34971&report=yes