stumbler has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I am having a hard time downloading a text file in the correct format from a Apache server (running in Unix).
All I am trying to do is to have a button to download a text file (let us say, 123.inp residing in htdocs folder) from the server. When I click on 'Download Text File' button, it should provide the option to either "Open" or "Save" the file.
Everything works fine except that if I click on 'Open', the file opens as one single line in "NotePad". I know it is because the file is downloaded in "binary" format but I don't know how to fix it. Any suggestion would be of great help
use CGI qw(:standard); use CGI::Carp 'fatalsToBrowser'; my $query = new CGI; print $query->header(); print $query->start_html(); print $query->button( -name => "Download", -value=>"Download Text File", -onclick=> "window.location.href='/123.inp';" ); print $query->end_html();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Downloading a Text file from a Unix server (Apace) using CGI
by swares (Monk) on May 03, 2007 at 20:28 UTC | |
by Anonymous Monk on May 04, 2007 at 00:51 UTC | |
|
Re: Downloading a Text file from a Unix server (Apace) using CGI
by almut (Canon) on May 03, 2007 at 21:18 UTC |