Re: [PHP Header] Right-Click Download in Firefox showing php filename
| From: | David Otton | Date: | Mon, 04 Aug 2008 09:40:38 +0000 |
| Subject: | Re: [PHP Header] Right-Click Download in Firefox showing php filename | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-277661@lists.php.net to get a copy of this message | ||
2008/8/4 Will <wilzdezign@gmail.com>:
> 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
> $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);
Try a variation on this:
header("Content-Type: application/x-msi");
header("Content-Disposition: attachment;
filename=\"ApplicationSetup_v1_0.msi\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize('Setup.msi'));
readfile('Setup.msi');
http://www.mhonarc.org/~ehood/MIME/rfc2183.txt
content-disposition controls what the browser should do with the file
you're sending (open it or save it).
filename suggests what the file should be saved as on the local
system, when downloading as an attachment
content-type is the mime-type of the file you're sending