hello list
i want to return an error to a user if they try submitting text typed
into a file upload field (instead of clicking 'browse' and pointing to a
file, the user types text into the box).
from perldoc CGI, i read this:
When called with the name of an upload field,
upload() returns a filehandle, or undef if the parameter
is not a valid filehandle.
so i try this code:
#!/usr/bin/perl -w
use strict;
use CGI;
use Data::Dumper;
my $cgi = new CGI;
my $file = $cgi->upload('file');
print $cgi->header;
print "file: ", Dumper($file);
exit();
the result always contains a ref to a filehandle, no matter what is
provided in the upload field (except if nothing is provided, in which
case it returns undef). am i wrong in assuming it should return undef
when the param is not a real file?
as a workaround, i have written code to return an error if uploadInfo()
does not have a 'Content-Type' value.
this is a rh6.2 server running perl 5.6.1 and apache/mod_perl 1.3.22
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]