in reply to uploadInfo - can't use undefined value as a HASH reference

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:

$checks{'data'} =~ tr/\0//d;

When I commented out that line, the uploadInfo function works.

Sanitizing your data really is a good idea. You can either pull out the Content-Type before you sanitize the filename, or just reject filenames that you don't like:
$filename =~ /^(\w[\w.]*)$/ or die "Invalid filename\n"; $filename = $1;

Also, it's strange that your sanitize function would have made a difference at all, unless there were NUL characters in your filenames.

Replies are listed 'Best First'.
Re: Re: uploadInfo - can't use undefined value as a HASH reference
by kiat (Vicar) on Apr 20, 2004 at 03:45 UTC
    Also, it's strange that your sanitize function would have made a difference at all, unless there were NUL characters in your filenames.
    It's indeed strange. But that transliterate line is likely to be the culprit in this particular instance, because uncommenting it with '#" triggers the "Can't use undefined value as A HASH reference..." error while commenting it out allows the code to run.