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