I am not sure if this is dumb,
but I am using params to get the info from the
upload text boxes....
I just wanted on the same script to read information from
a previous script and that's why I am using read...

-Lia-


-----Original Message-----
From: Lee Goddard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 20, 2001 12:43 PM
To: Schiza, Apostolia (ISS Atlanta)
Cc: perl-win32-web@listserv. ActiveState. com (E-mail)
Subject: Re: problem with CGI and read...(??)


I don't use CGI pm, so excuse what may be ignorance, 
but why are you reading the data in AND using CGI pm
to import params()?


lee

"Schiza, Apostolia (ISS Atlanta)" wrote:
> 
> Hi folks,
> can somebody identify what is wrong with the following script?
> A previous script makes a POST request and calls this perl script, but for
> some reason this latest one just hungs and does nothing...
> Is there any issues with CGI and the read function? I've seen this
> behavior again, and it seems like CGI and the read function do not
> cooperate.?.
> Please help!
> 
> Thank you
> 
> -Lia-
> 
> -----Script------
> 
> #!/usr/bin/perl
> 
> use CGI qw(:all);
> 
> use Fcntl qw(:DEFAULT :flock);
> 
> my $SUBJECT = 'File upload';
> my $envData;
> 
> # It cannot get the data from the POST request! Hungs here till timeout...
> read(STDIN, $envData, $ENV{'CONTENT_LENGTH'});
> print $envData;
> 
> #Here start doing the uploading...
> my @params = param();
> 
> if (my $error = cgi_error())
> {
>         print header(-status => $error);
>         exit 0;
> }
> 
> print   header,
>         start_html("Upload"),
>         h1("Upload"),
>         hr,
>         start_multipart_form,
>         table(Tr(td(p('upload:')),
>                 td(filefield('uploaded_file'))),
>               Tr(td(p('upload:')),
>                 td(filefield('uploaded_file2'))),
>               Tr(td({ -colspan => 2 }, submit))),
>         end_multipart_form,
>         hr;
> 
> if (@params)
> {
>         if ((my $file = upload('uploaded_file')) and (my $file2 =
> upload('uploaded_file2')))
>         {
>                 print "ok got here, now what?";
>                 print $file;
>                 print $file2;
> 
>                 sysopen(FILE1, "decFiles\\firstfile.txt", O_RDWR |
O_CREAT)
> || print "did not make it";
>                 while(my $line=<$file>)
>                 {
>                         print { FILE1 } $line ;
>                 }
>                 close(FILE1);
> 
>                 sysopen( FILE2, "decFiles\\secondfile.txt", O_RDWR |
> O_CREAT) || die "errorpage here";
>                 while(my $line=<$file2>)
>                 {
>                         print { FILE2 } $line ;
>                 }
>                 close(FILE2);
>         }
>         elsif((!$file || !$file2)&& cgi_error())
>         {
>                 print header(-status=> cgi_error());
>                 exit 0;
>         }
> 
> }
> 
> print end_html;
> 
> _______________________________________________
> Perl-Win32-Web mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

-- 

Lee Goddard     <[EMAIL PROTECTED]>
-------------------------------------
Perl : XML : XSLT : XHTML / JS : Java

"Post-modernism....the meta-narrative that denies meta-narrative."
                                           - Cedric Watts, Sussex 1997
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to