http://www.perlmonks.org?node_id=202142

heezy has asked for the wisdom of the Perl Monks concerning the following question:

Hi Everybody

I tried to incorporate file uploading into an exsiting Perl script and I failed. So I thought I would search around on Perlmonks, I did, and I found lots of useful info on how to create a file upload script however my exsisting script is messy so I thought i would try something nice and simple to start with

I want to select a file from a browse box on a form, click submit, and have the contents of the file echoed back to the browser for display

The webpage is a simple multi content file submission form with a submit button (and I'm sure this end is right as the script prints the name of the file entered)

#!/apps/PERL5/bin/perl use CGI qw(:standard); use CGI::Carp qw/ fatalsToBrowser /; $cgi = new CGI; print header; my $b_File = $cgi->param('user_File01'); print p("b_File ($b_File)"); my $fh = $cgi->upload($b_File); while (<$fh>){ print p("Data ($_)"); }

This must be a simple thing to do, and surely the above code should suffice?

It prints the name of the file to the screen (just the name no path info - Netscape7.0b) But does not print the details back to the browser for display?

I'm guessing it's something stupid that I'm doing as I though I understood the basic CGI.pm concepts from the Lincoln Stein book and the O'Reilly CGI book.

Please help!!

Have a great day where ever you are

Mark

:o)