Re: [PHP Header] Right-Click Download in Firefox showing php filename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2008/8/4 Will <wilzdezign@xxxxxxxxx>:

> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux