Re: OT - How to code a link to download a file (program file)
| From: | Rahul Sitaram Johari | Date: | Mon, 26 Mar 2007 19:49:27 +0000 |
| Subject: | Re: OT - How to code a link to download a file (program file) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-251405@lists.php.net to get a copy of this message | ||
Ave,
To be honest, I don't think it's OT.
I ran into a similar problem quite a while back, working on a File Manager
application programmed in PHP/mySQL. I used the following 'fore-download'
header in php which assured the user present with a Save Dialog box to
download the file, and not open the file in IE.
<?php
header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".basename($F));
@readfile($F);
?>
$F was the filename passed as a variable.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.
W: http://www.rahulsjohari.com
E: sleepwalker@rahulsjohari.com
³I morti non sono piu soli ... The dead are no longer lonely²
On 3/26/07 3:43 PM, "Richard Lynch" <ceo@l-i-e.com> wrote:
> On Sun, March 25, 2007 8:41 am, Lorin Lund wrote:
>> I have a web site where I have posted some programs I have written as
>> shareware.
>>
>> <a href="myprogram-setup.exe">click here to download</a>
>>
>> works great with mozilla but with MS IE it tries to display the
>> program.
>> What is the simplest way to set it up so that the user just clicks on
>> the
>> link and the program gets downloaded for storage/execution on their
>> system?
>
> http://richardlynch.blogspot.com