[PHP Header] Right-Click Download in Firefox showing php filename
| From: | Will | Date: | Mon, 04 Aug 2008 03:47:13 +0000 |
| Subject: | [PHP Header] Right-Click Download in Firefox showing php filename | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-277655@lists.php.net to get a copy of this message | ||
I followed some of the examples that was on PHP header()
http://us3.php.net/manual/en/function.header.php
I am trying to have users download a file named 'Setup.msi', however
under a PHP file with the sent header information, the default name to
the user will be 'ApplicationSetup_v1_0.msi' -- I am sending the
recommended header information in the notes. For example in my
'download.php':
$forcename = "ApplicationSetup_v1_0.msi";
$filename = "Setup.msi";
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream; name=".$forcename);
header("Content-Type: application/octetstream; name=".$forcename);
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
@readfile($filename);
When I LEFT-CLICK the 'download.php' link in Internet Explorer 6/7 and
Firefox 2/3, it defaults the download name to the variable that I want
it changed to ($forcename). When I RIGHT-CLICK in Internet Explorer
6/7, it also works. However when I RIGHT-CLICK the link in Firefox
2/3, it downloads the file as 'download.php' and not the specified
name and .msi extension (I can still rename to the .msi extension and
it works fine). Am I missing another header or is there known issue
for Firefox right-click "Save Link As..." and default the name to
something else? Or should I contact Firefox on this to get more
information to default the name to something different?
Thanks
--
William Frankhouser
WilzDezign
http://www.wilzdezign.com