kiat has asked for the wisdom of the Perl Monks concerning the following question:
I'm getting this error when using uploadInfo:
Can't use an undefined value as a HASH reference at D:/site/modules/Subs.pm line 804.
In Subs.pm, I've
Did I forget to import some functions? Please help and thanks in advance :)use strict; use CGI; my $q = new CGI; sub mimetype { my $file = shift; my $mimetype = $q->uploadInfo($file)->{'Content-Type'}; # line 804 return $mimetype; }
Update: Found a forum whereby someone brought up the same problem at
http://www.cookwood.com/cgi-bin/lcastro/perlbbs.pl?noframes;read=9176
The only solution was to have 'use CGI qw(:standard);'
Update2: Found the solution at:
http://forums.devshed.com/showthread.php?t=132647
That led me to look at my sanitize sub. What happened was that $file was "sanitized" for character checking. I had a line in sanitize() as follows:When I commented out that line, the uploadInfo function works.$checks{'data'} =~ tr/\0//d;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: uploadInfo - can't use undefined value as a HASH reference
by sgifford (Prior) on Apr 20, 2004 at 01:40 UTC | |
by kiat (Vicar) on Apr 20, 2004 at 02:46 UTC | |
|
Re: uploadInfo - can't use undefined value as a HASH reference
by sgifford (Prior) on Apr 20, 2004 at 03:38 UTC | |
by kiat (Vicar) on Apr 20, 2004 at 03:45 UTC |