redmustang has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use CGI qw(:standard); print header; print start_html('Download'), h1('Download'), start_form, p, "Feet? ",textfield(-name=>'feet', -size=>5), "Inches? ",textfield(-name=>'inches', -size=>5), p, submit(-value=>'Create File'), end_form, hr; if (param()) { $feet=param('feet'); $inches=param('inches'); $filename=param('feet') . param('inches') . '.txt'; $tape = <<END; It is $feet ft. $inches in. END # print header(-type=> "application/octet-stream", # -charset=>'UTF-8', # -attachment=>$filename); # print $tape, print "Content-Type: application/octet-stream; name=$filename\n"; print "Content-Disposition:attachment; filename=$filename\"\n\n"; print $tape; }
the browser window shows
Content-Type: application/octet-stream; name=53.txt Content-Disposition:attachment; filename=53.txt" It is 5 ft. 3 in.I haven't been able to get the download part to work however I can see the text by viewing source.
Thanks, Darrell
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Web form creates txt file and downloads scalar as a file
by Corion (Patriarch) on Mar 13, 2011 at 16:31 UTC | |
|
Re: Web form creates txt file and downloads scalar as a file
by wind (Priest) on Mar 13, 2011 at 16:31 UTC |