How to start a file download using CGI?
Posted on 1997-11-08
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):
<input type="hidden" name="THISPROGRAM" value="DOWNLOAD">
<input type="text" size="30" name="address">
...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.