Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I’ve been using a CGI perl script to upload files on our web server. The server is Windows 2003, IIS. The program works great, especially after I discovered binmode.

My problem is that I can’t get large files to work.

I’ve played with the buffer, filesize, that doesn’t seem to be the issue.

Here’s the test results, all using the same script on various Windows servers:

Test 1
Server:.........Windows 2003, IIS on web.
Connection:.....384kbs upstream
Result:.........Files over 8 to 10Mb don’t upload

Test 2
Server:.........Windows 2003, IIS on web.
Connection:.....768kbs upstream
Result:.........Files over 18 to 21Mb don’t upload

Test 3
Server:.........Windows 2000 Advanced Server, IIS on LAN.
Connection:.....Gigabit LAN
Result:.........Seems to be no limit on size.

What the results look like to me, is that the browser is timing out, waiting for the upload to finish.

If that’s the case, any ideas on the fix?

Thanks,

Wowski

Replies are listed 'Best First'.
Re: CGI Uploads - Large File Sizes
by Thelonius (Priest) on May 02, 2005 at 19:07 UTC
    Most likely it is the server which is timing out. IIS has at least a couple of timeouts. I'm not an expert on IIS administration, but using the version on my Win2000 workstation, if you look in Internet Services Manager, the first tab on properties for the web server is "Web Site" which has as "Connection Timeout" property (mine is 900 seconds). Then, under the "Home Directory" tab, if you click "Configuration...", there's an "App Options" tab which includes "ASP script timeout" (mine says 90 seconds). I dunno if this applies to CGI scripts. If you are using Perl as an ASP process, you can set the script timeout there using the ScriptTimeout property of the $Server object (I'm guessing that this will still not go any longer than the Connection Timeout, though).
      900 seconds, that's 15 minutes.

      I'll try it at 1800 sec.

      Thanks,
      Wowski
Re: CGI Uploads - Large File Sizes
by derby (Abbot) on May 02, 2005 at 19:47 UTC

    hmmm ... Are you using CGI.pm? If so, have you checked $CGI::POST_MAX ... it may be set and you'll need to either set it higher or disable it.

    -derby
      Yes,

      I've got $CGI::POST_MAX set to 100Mb.

      Wowski
Re: CGI Uploads - Large File Sizes
by TedPride (Priest) on May 03, 2005 at 03:00 UTC
    A related question - can you delay timeout by setting Perl to flush the buffer after every print, and printing a character every x number of chunks? Does the timeout count from the time data was last received from the script, or from the time the script started?