if($ENV{CONTENT_LENGTH} > $CGI::POST_MAX) { print "Content-type: text/plain\n\n"; print "ERROR: you tried to send $ENV{CONTENT_LENGTH} bytes,\nbut the current limit is $CGI::POST_MAX bytes.\nPlease go back and choose a smaller file.\n"; exit; } elsif(!$query->param('uploadname')) { print "Content-type: text/plain\n\n"; print "ERROR: the upload file-field is blank.\nEither you didn't choose a file, or there's some problem with your server.\nMaybe you need a newer version of the CGI.pm module?\nOr maybe your webhost/server doesn't allow file uploads?\n"; exit; } elsif(!($file_ext == 'jpg') || !($file_ext == 'gif') || !($file_ext == 'png')) { print "Content-type: text/plain\n\n"; print "ERROR: Nicht erlaubte Dateiendung.\n"; exit; }