Re: OT - How to code a link to download a file (program file)

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

 



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@xxxxxxxxxxxxxxxx

³I morti non sono piu soli ... The dead are no longer lonely²


On 3/26/07 3:43 PM, "Richard Lynch" <ceo@xxxxxxxxx> 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

-- 
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