note 25801 added to function.fpassthru
| From: | mikek at rack1 dot php dot net | Date: | Mon, 07 Oct 2002 08:44:14 +0000 |
| Subject: | note 25801 added to function.fpassthru | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-37732@lists.php.net to get a copy of this message | ||
Found a workaround for the MSIE cache bug that puts brackets around dotted items I posted about a
while back (e.g. "somefile1.0-xyz.zip" becoming "somefile[1][0]-xyz.zip").
It turns out if you encode all but the last dot as %2e, then MSIE won't do this. If you encode
all of them (including the last dot), then MSIE sticks an extra bracketed number at the end of the
file (e.g. "somefile1.0-xyz.zip[1]"). Unfortunately, however, some other browsers then
want to save the file with the %2e in the filename instead of the dots.
if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
{
$fileName = preg_replace('/\./', '%2e', $fileName,
substr_count($fileName, '.') - 1);
}
Viola. Properly named files. This works at least with MSIE 6.0.
--
http://www.php.net/manual/en/function.fpassthru.php
http://master.php.net/manage/user-notes.php?action=edit+25801
http://master.php.net/manage/user-notes.php?action=delete+25801
http://master.php.net/manage/user-notes.php?action=reject+25801