I tried using your test script with my test.html that i sent and nothing



-----Original Message-----
From: Curtis Poe [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 31, 2001 9:00 AM
To: CGI Beginners
Subject: RE: "multipart/form-data" Method "POST" to cgi script not
working


--- mlists <[EMAIL PROTECTED]> wrote:
>
>       Here is the code, the HTML page that is a template that is merged with
the
> %data hash handled by sub "merge_template"
> I've even wrote little test pages and scripts just to test the data
passing
> and that is where i discovered the diff between "POST" and "GET"...i will
> send those too...
>
> During the post no data is passed to the cgi....i.e. $cgi->param('PARAM')
=
> nothing
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! test html
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> <html>
>
> <head>
> <title>test</title>
> </head>
> <html>
> <body>
> <form enctype="multipart/form-data" method="POST"
> action="/apps/test1/test.cgi">
> Select File: <input TYPE="FILE" NAME="FILE_TO_UPLOAD"><br>
> Favorite color:<input TYPE="TEXT" NAME="FAVCOLOR"><br>
> <INPUT NAME="SUBMIT" TYPE=SUBMIT VALUE="SUBMIT">
> </form>
> </body>
> </html>
>
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! test cgi
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> #!/usr/bin/perl
>
> use CGI;
> $cgi = new CGI;
>
>
> $submit = $cgi->param('SUBMIT');
> $fh = $cgi->param('FILE_TO_UPLOAD');
> $fav = $cgi->param('FAVCOLOR');
>
> open(UPLOAD, ">/tmp/fileuploadtest");
> while (<$fh>)
> {
>
>         print UPLOAD;
>
> }
>
> close(UPLOAD);
>
> open(LOG, ">/tmp/test.log");
> print LOG "$submit\n";
> #print LOG "$file\n";
> print LOG "$fav\n";
> close(LOG);
>
>
> print $cgi->header;
> print $cgi->start_html;
>
>
> print "$submit<br>";
> print "$fh<br>";
> print "$fav<br>";
>
> print $cgi->end_html;

I don't see any immediate problem (though maybe it's glaring and I'm just
not getting enough
coffee).  Here's a test script you can try to verify that you're getting
data sent:

    #!/usr/bin/perl -wT
    use strict;
    use CGI;
    use Data::Dumper;

    my $cgi = CGI->new;

    print $cgi->header,
          $cgi->start_html( 'CGI Test' ),
          $cgi->pre( Dumper $cgi ),
          $cgi->end_html;

That will dump the CGI object to the screen.  You'll see something like the
following:

$VAR1 = bless( {
                 '.header_printed' => '1',
                 '.charset' => 'ISO-8859-1',
                 '.parameters' => [
                                    'color',
                                    'name'
                                  ],
                 '.fieldnames' => {},
                 'name' => [
                             'Ovid'
                           ],
                 'color' => [
                              'red'
                            ]
               }, 'CGI' );

The '.parameters' will tell you the name of any parameters that were passed
and later you can see
the values associated with the individual parameters.  It will also show you
cookies, if
available.  They'll be in a CGI::Cookie object.

Basically, if you get no .parameters, you know that the CGI object did not
get any data.

Cheers,
Curtis Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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


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

Reply via email to