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)


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

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.