note 27066 added to function.fpassthru
| From: | john at rack1 dot php dot net | Date: | Thu, 21 Nov 2002 18:05:28 +0000 |
| Subject: | note 27066 added to function.fpassthru | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39826@lists.php.net to get a copy of this message | ||
In reply to:
"3. Through no amount of futzing of headers was I able to get the filename to be set properly
when the actual transfer was initiated via a refresh (META or via headers). I don't know if
this is also an MSIE only issue or not. If 'download.php?dl=now' (for example) had a
refresh back to 'download.php', such that it was intended to show some information (e.g.
install instructions) as well as launch the download, then the MSIE insisted that the downloaded
file was supposed to be named 'download.php?dl=now' or 'download.php', ignoring
the filename in the headers."
I recently had the exact same issue. What I found is that this was due to my session initialization
on the page. For some reason doing a session_start() caused the script to try and download itself,
not what I was indicating through various header() calls.
The solution was to move the download portion above the session initialization. At first glance
this may seem dangerous, but I only process it if there are POST vars and the script is reloading
itself. This way I know the form was submitted by that page and before they can submit it, they
have to have a session! Adding an .htaccess rule to deny all for the directory where the files are
stored also helps because then only my script can access the files.
--
http://www.php.net/manual/en/function.fpassthru.php
http://master.php.net/manage/user-notes.php?action=edit+27066
http://master.php.net/manage/user-notes.php?action=delete+27066
http://master.php.net/manage/user-notes.php?action=reject+27066