UPDATE: I've tracked this down through further testing to a conflict between certain builds of apache and certain versions of CGI.pm. This is discussed on various websites under the error message of
CGI.pm: Server closed socket during multipart read
Sadly my webhost is technically challenged enough that they don't know how to fix this. Switching to another host where script works. Thanks to all your help.

ORIGINAL MESSAGE
------------------
Hello Monks, I've just discovered you all and hoping someone might have knowledge of my problem. I have some code that runs fine on one hosting company but fails on another: iPowerWeb. I've created a super simple test listed below.

#!/usr/bin/perl use Image::Magick; use CGI; my $req = new CGI; print "Content-type: text/html\n\n"; print "<h1>Test Result</h1>"; print "Everything OK";


SCENARIO: a simple html form with a single file upload control calls the script above. The script does nothing except ask to use two modules and then ask for a new CGI object.

RESULT: The code works fine with files of less than 15k. It fails with files over 20k. Failure is a 500 server error. Running the script with strict and -w produce no errors or warnings other than the usual "premature end of script headers".

ALTERNATE TEST 1 -- CGI WORKING OK WITHOUT IMAGE MAGICK: Thanks to tips from Monks "Marto" and "Zentara" i tried the exact script as above except i removed the "use Image::Magick" line and added a simple line to test if CGI object was created. Result is that all files upload properly and a cgi object is created properly. So it is the interaction with Image::Magick and CGI that is the problem.

#!/usr/bin/perl use CGI; my $req = new CGI; my $f = $req->param("TOPPIX"); print "Content-type: text/html\n\n"; print "<h1>Test Result</h1>"; print "Everything OK $f";


ALTERNATE TEST 2 -- WORKS IF CGI OBJECT NOT CREATED: Another test with removal of the "my $req = new CGI;" line allows the script to function properly with all file sizes.

#!/usr/bin/perl use Image::Magick; use CGI; print "Content-type: text/html\n\n"; print "<h1>Test Result</h1>"; print "Everything OK";


QUESTION: Anyone know why this could be happening? iPowerWeb folks are stumped and have bailed on it. My apologies if this is outside the realm of the monestary's usual consideration. Happy to have found you either way. Many thanks, barry

In reply to large file upload fails on 'new CGI' request by stonebreaker

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.