Are you passing the MAX_UPLOAD_SIZE as hidden input inyour form? If so you are probably getting the standard php error. INstead of passing it that way try omitting that hidden variable and instead on your processing page check for the size of the file for instance if the file field in your form is named file, you would be able to access the size of it as $file_size so you could say
if ($file_size > 40000) {
print "Image must be less than 40kb";
}
In addition you have $file_name would be just the name of the uploaded file (bird.jpg) or something like that and $file_type (image/gif or image/jpg)