Warren,

Thank you for the response.  

I had actually tried this syntax:

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

But I can not seem to access anything from the form via this method.  In fact 
there seems to be little I can get from the Request object.  If I submit my 
form and try:
           print "Request total bytes $Request->{TotalBytes}<br>";
           print "Request method $Request->{Method}<br>";

I get:
Request total bytes 0
Request method POST

Also when I try to grab any form content via the construct you suggest, I get 
no content.  For example, in my form I have a required field 'Title'.  Testing 
access to my fields using both CGI and the native asp methods:

        my $form = $Request->Form;
      my $title = $form->{'Title'};
      my $title2 = $query->param("Title");
        print "asp title: $title<br>";
        print "cgi title: $title2<br>";

results in

asp title:
cgi title: test title


Any ideas on what could be botching or interfering with the Request object?

Andrew Koebrick

-----Original Message-----
From: Warren Young [mailto:war...@etr-usa.com] 
Sent: Tuesday, June 30, 2009 8:42 PM
To: Apache-ASP List
Subject: Re: File upload problem

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


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

Reply via email to