RE: Why does this CGI process hang?
by Kamphuys, ing. K.G. other posts by this author
Aug 28 2001 6:30AM messages near this date
view in the new Beta List Site
Re: Why does this CGI process hang?
|
Re: Why does this CGI process hang?
Hi Philip (and others),
Though your answer stops the CGI process from hanging, it also fails to do
what I want, that is printing the content of the uploaded file. Somewhere
in the documentation of the CGI module I got a clue that I should specify
STDIN as a parameter to the creating of the CGI object, but I apparently
misunderstood that.
But do you have any idea how to get the contents of the uploaded file
available? As the documentation states, the filename (here in
$input{file}) also serves as a file handle and that was, as far as I can
understand, what I did. TIA.
Koen Kamphuys
The form:
<FORM METHOD="post" ACTION="/cgi-bin/test.pl" ENCTYPE="multipart/form-data"
>
<input type="file" name="file">
<input type="submit" value="upload">
</FORM>
The script (as by now):
use CGI;
$query = new CGI;
print $query-> header;
@names = $query-> param;
for $name (@names) {
$input{$name} = $query-> param($name);
}
for $key (keys %input) {
print "$key --> $input{$key}<br>"; #Left out some HTML printing crap...
}
while (<$input{file}> ) {
print;
}
In Perl-Win32-Web, Newton, Philip [mailto:Philip.Newton@[...].de]
wrote:
>
> Kamphuys, ing. K.G. wrote:
> >
> > $query = new CGI(\*STDIN);
>
> What do you expect that to do?
>
> The way I understand it, this tries to initialise a CGI object with
> TAG=VALUE pairs read from standard input where they were
> previously saved.
> But if you use multipart/form-data encoding, that's not the
> format they come
> in -- and even if you use standard text/www-url-encoded (or
> whatever it's
> called), you probably just want to use plain
>
> $query = new CGI;
>
> . Try that and see whether it then works.
>
> Cheers,
> Philip
> --
> Philip Newton <Philip.Newton@[...].de>
_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Web@[...].com
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
|