Lorenzo, by doing "perldoc CGI" and searching for "limit", I found this info on how to limit the size of upload files:
---------------------------------------
CGI.pm also has some simple built-in protections against
denial of service attacks, but you must activate them
before you can use them. These take the form of two
global variables in the CGI name space:
$CGI:

OST_MAX
If set to a non-negative integer, this variable puts a
ceiling on the size of POSTings, in bytes. If CGI.pm
detects a POST that is greater than the ceiling, it
will immediately exit with an error message. This
value will affect both ordinary POSTs and multipart
POSTs, meaning that it limits the maximum size of file
uploads as well. You should set this to a reasonably
high value, such as 1 megabyte.
$CGI:

ISABLE_UPLOADS
If set to a non-zero value, this will disable file
uploads completely. Other fill-out form values will
work as usual.
You can use these variables in either of two ways.
1. On a script-by-script basis
Set the variable at the top of the script, right after
the "use" statement:
use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser';
$CGI:

OST_MAX=1024 * 100; # max 100K posts
$CGI:

ISABLE_UPLOADS = 1; # no uploads
2. Globally for all scripts
Open up CGI.pm, find the definitions for $POST_MAX and
$DISABLE_UPLOADS, and set them to the desired values.
You'll find them towards the top of the file in a
subroutine named initialize_globals().
Since an attempt to send a POST larger than $POST_MAX
bytes will cause a fatal error, you might want to use
CGI::Carp to echo the fatal error message to the browser
window as shown in the example above. Otherwise the
remote user will see only a generic "Internal Server"
error message. See the the CGI::Carp manpage manual page
for more details.
---------------------------------------
I also wanted to point out that "the string parsed from the form" is *NOT* suitable for use as a file handle, and that's why in both my example, and "goBoating"s example we don't open the upload file for reading by using the "open" command(to get a filehandle to the file) - instead we use the direct "read" command to read a specified number of bytes directly from the upload filename(which if I remember right is an absolute path/filename when received by the CGI "param" method). Maybe that's why you had trouble with my code - you did your own parse of the POST variables instead of letting CGI.pm "param" method do it for you - maybe your parse did not properly receive the name(including absolute path?) of the upload file - so maybe the "read" couldn't find the file on the client system. Just a guess.
One more thing - when you finish this file upload code, it would make a great "file upload faq" for this Perl forum. HTH.
Hardy Merrill
Mission Critical Linux, Inc.