Andrew Koebrick (ADM) wrote:
(http://www.apache-asp.org/cgi.html) that the recommendation is to roll back to CGI v2.78.

The docs are just giving that version as a known-working example. I've successfully uploaded files to servers running CGI.pm v2.89 and v3.15.

I end up with an empty file on my server.

Empty, or missing?

If you're expecting to access the actual file-on-disk, rather just read the data via a file handle, you need to set

        PerlSetVar FileUploadTemp 1

in your httpd.conf file. Otherwise, Apache deletes the temp file it uses to hold the upload. As an example of why you'd care, my code sets this configuration variable this because the first thing it does is 'mv' the file to its new permanent home in the filesystem.

If I try to read directly from request->Form I get the error:

Perl is case-sensitive, and the $ is not optional. It's "$Request->Form". I typically do this at the top of pages that receive form posts:

    if ($Request->{Method} eq 'POST') {
      my $form = $Request->Form;
      # process $form->{stuff} here
    }

Being able to access the form values via $form saves a lot of typing.

 my $filename = $query->param("Identifier-upload");

I would only use CGI.pm to set up the file upload form, as described in the Apache::ASP docs. I wouldn't continue to use it on the POST handling side like this. Apache::ASP has its own mechanisms, which I'd trust more. Using the shorthand above, you'd say
        
        my $filename = $form->{Identifier-upload};

instead.

my $upload_filehandle = $query->upload("Identifier-upload");

Again, you're fighting Apache::ASP by doing things through CGI.pm that Apache::ASP already does. If you want just the file handle, that's

        $Request->{FileUpload}{upload_field}->{FileHandle}

...in ASP-speak.  See http://www.apache-asp.org/cgi.html#File%20Upload

If you set the httpd.conf variable as above, the name of the file is in

        $Request->{FileUpload}{mfile}->{TempFile}

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscr...@perl.apache.org
For additional commands, e-mail: asp-h...@perl.apache.org

Reply via email to