I'm having a problem with a file upload CGI script. It seems no matter how high I set $CGI::POST_MAX (using CGI.pm), I can never upload more than 1 mb to the server. The error code return by the server is "413 Request Entity Too Large". Doesn't seem to matter if the file is binary or text and everything smaller than 1 MB uploads fine.

Could there be a server setting to adjust or is there a problem with my code?

$CGI::POST_MAX=1024*100000; my $q = new CGI; my $myFile = $q->upload('file'); binmode($myFile); if (!$myFile && cgi_error()) { print $q->header(-status=>cgi_error()); print $q->p("Error"); exit 0; } my $dir = "c:\\inetpub\\scripts\\perl\\uploads"; open (MYFILE,">$dir\\test_upload.txt") || die $!; binmode(MYFILE); while (<$myFile>) {print MYFILE $_; } close (MYFILE);
Server is NT4 SP6a
IIS4
Active State Perl 5.6.1

Thanks for the help!

In reply to File upload limited to 1 M B by jiggs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.