On Wednesday, Oct 1, 2003, at 08:12 US/Pacific, A L wrote: [..]
that refers to the following CGI:

 #!/usr/bin/perl -w
use strict;
use CGI qw/:standard/
print "Content-type: text/html\n\n";

print $query->filefield('uploaded_file');

there is the minor detail here that you did not declare what a '$query' is ...

$filename = $query->param('uploaded_file');
$fh = $query->upload('uploaded_file');
while (<$fh>) {
  print;
  }
I am reading the CGI.pm from Lincoln Stein's webpage.

good choice.


 But, it's too difficult for me to follow what I am supposed to do.
I just want to be able to load a file from a local drive while on
the web, then, print out the loaded file's content to the web after
it has been through CGI.  Am I making sense?  Any help would be
appreciated.  I would also like help on the very basic idea of
what I am trying to accomplish.  Thanks.

I think your basic idea might be easier to see as two different pieces of CGI code or one HTML file that calls a cgi script.

cgi_code_a sends to the browser the HTML that is the form
the user will fill in to find a file. In the 'action' attribute
for that form it will reference cgi_code_b.
Note this part could be a static html file.

cgi_code_b will then read the parameters passed to it,
and do the file up_load sequence and as you wish present
the information from the file.

minor note - if you peek into CGI.pm you will notice


'upload' =><<'END_OF_FUNC', sub upload { my($self,$param_name) = self_or_default(@_); my $param = $self->param($param_name); return unless $param; return unless ref($param) && fileno($param); return $param; } END_OF_FUNC

so you might want your code to be doing

        my $fh = $query->upload('uploaded_file');
        while (<$fh>)
        {
                #
                # stuff we do with that reference to the uploaded file
                #
        }
unless you are really want to play with the $query->param()
and the other method calls...

HTH.


ciao drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to