Link to home
Start Free TrialLog in
Avatar of Kapusta
Kapusta

asked on

How to start a file download using CGI?

I am trying to implement a single HTML Web page at my Web site that performs two actions:

1) Prompt the visitor for their email address and then...

2) Start a download of a specific .ZIP file


I have a form on a Web page (example):

<form
action="https://www.mysite.com/myaccount/cgibin/download.cgi"
method="POST">
<input type="hidden" name="THISPROGRAM" value="DOWNLOAD">

<input type="text" size="30" name="address">
</form>

...and I know enough about CGI/Perl to be dangerous.  The current CGI script
I use can retrieve the email "address" input from this form and use it. This is no problem.  I am fine here.  However, my problem is I don't know how a CGI script can initiate a file transfer, in this case MYPROG.ZIP
located at:   www.mysite.com/pub/myprog.zip to the visitor's browser.

I wish that a form action could run TWO commands at the same time, but I fear that this is not possible, therefore I must initiate the file download/transfer from the cgi script (which I don't know how to do).

Any suggestions and examples would be greatly appreciated.
Avatar of Kapusta
Kapusta

ASKER

Edited text of question
Avatar of Kapusta

ASKER

Adjusted points to 150
Avatar of Kapusta

ASKER

Adjusted points to 250
ASKER CERTIFIED SOLUTION
Avatar of alamo
alamo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial