in reply to Re: File Upload + recording
in thread File Upload + recording "metadata"

Should perhaps be:
< my $fh = $query->upload('upload_file'); > my $fh = $query->param('uploaded_file'); # file input control is named "uploaded_file" and < open OUTPUT, "/foo/save" or die "Can't open: $!"; > open OUTPUT, "> /foo/save" or die "Can't open: $!";
One problem I've found is that when uploading files larger than around ~60-70k, I get a problem in trying to instantiate CGI.pm. (Apache flips me the bird and takes me to an error screen). Is this a known problem? Has anyone else struck this?

Replies are listed 'Best First'.
RE: RE: Re: File Upload + recording
by btrott (Parson) on Jun 15, 2000 at 06:48 UTC
    You're right about the open on the OUPUT filehandle. I think we're both right on the first thing (param vs. upload), though. :) As the CGI.pm docs say this:
    To be safe, use the upload() function (new in version 2.47). When called with the name of an upload field, upload() returns a filehandle, or undef if the parameter is not a valid filehandle. $fh = $query->upload('uploaded_file');
    Calling param on an uploaded file field gives you a thing that's both a string and a filehandle. Using upload just makes sure you get a filehandle, as it's less of a security risk.

    As to your question re: big uploads: do you get any out of memory errors? 60-70k doesn't seem like *that* big a value. Could it be a POST limitation?

      Yes, my apologies. It turns out I was using an old version of CGI.pm Upgraded and unearthed the upload() function.
      Just trolled the apache error logs and can see an error message being generated from mod_perl:
      [client xxx.xx.xxx.xxx] Request content-length of 84482 is larger than the configured limit of 75000
      Which probably explains my problem with file upload size :)
      Thanks a lot for your help.

      *a bit later* Turns out this:

      LimitRequestBody 75000
      was in my httpd.conf file! *slaps forehead*
        I think the maximum request size is configurable. Check out the LimitRequestBody directive in the Apache docs.