in reply to file upload, max_post, and cgi-error

Here is the code that my script executes when there are no parms (max_post exceeded)...Don't know how I could make it any dumber. The emailwebadmin and dienice execute but still getting the "page cannot be displayed from the html portion. That code runs if I put it in a standalone module. Is there any type of disconnect happening here instigated by post_max? # # No input parms # else { $cgierr = CGI::cgi_error(); if ( $cgierr ) { print "Content-type:text/html\n\n"; print "<HTML><HEAD><TITLE>Error</TITLE></HEAD>"; print "<BODY>"; print "$cgierr\n"; print "</BODY>"; print "</HTML>"; # # Send an email to the web admin emailwebadmin ("A submitted RESUME is too large. The CGI error is: $cgierr"); } else { emailwebadmin ("No input parameters found!"); dienice ("jobappr.pl: No input parameters found! The Web administrator has been notified."); exit(); } }
  • Comment on Re: file upload, max_post, and cgi-error

Replies are listed 'Best First'.
Re^2: file upload, max_post, and cgi-error
by Your Mother (Archbishop) on Oct 05, 2004 at 03:26 UTC

    Well, your code (the header/error part of it) ran properly for me. Here is a slightly more explicit version you might try on your own server. I'm running Apache 2.

    use warnings; use strict; use CGI qw(:standard); $CGI::POST_MAX = 2_000; # play nice my $uploaded_file = param('upload'); if ( not $uploaded_file and cgi_error() ) { print header(-status=>'200 OK'), # this might help, or not... start_html(-title=>'TOO BIG'), h2("Why are you disrespecting me with that file size?"); } else { print header(), start_html(-title=>'Just right!'), h2("I'm Okay, You're not so bad."); } print start_multipart_form(), filefield(-name=>'upload'), submit('Upload'), end_form(), end_html();
      thanks for the script. I ran this on my system and get "Page cannot be Displayed" when I specify a file larger than post_max. Same behavior as my script.