my $q = new CGI; my $filehandle = $q->upload("file"); ... my $file_size = $ENV{CONTENT_LENGTH} - $size_other_fields - $size_form_structure; if ( $size > $limite ) { die "Wow, file too big! Bye!"; }