Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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 concepts from the Lincoln Stein book and the O'Reilly CGI book.

Please help!!

Have a great day where ever you are



In reply to cgi File Upload, No data pased through? by heezy

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2022-08-17 10:08 GMT
Find Nodes?
    Voting Booth?

    No recent polls found