Search the web
Sign In
New User? Sign Up
apache-asp · Apache::ASP
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
File upload problem   Message List  
Reply | Forward Message #2270 of 2277 |
RE: File upload problem / $Request->Form problem

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:warren@...]
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-unsubscribe@...
For additional commands, e-mail: asp-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@...
For additional commands, e-mail: asp-help@...




Wed Jul 1, 2009 5:07 pm

Andrew.Koebrick@...
Send Email Send Email

Forward
Message #2270 of 2277 |
Expand Messages Author Sort by Date

I am attempting to implement an upload script and having problems. I see from the apache::asp documentation (http://www.apache-asp.org/cgi.html) that the...
Andrew Koebrick (ADM)
Andrew.Koebrick@...
Send Email
Jun 30, 2009
9:52 pm

... 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. ... Empty,...
Warren Young
warren@...
Send Email
Jul 1, 2009
1:44 am

Warren, Thank you for the response. I had actually tried this syntax: if ($Request->{Method} eq 'POST') { my $form = $Request->Form; # process $form->{stuff}...
Andrew Koebrick (ADM)
Andrew.Koebrick@...
Send Email
Jul 1, 2009
5:10 pm

... Would I be correct in guessing that this Apache::ASP application is brand new, and hasn't been running successfully for some time in the same...
Warren Young
warren@...
Send Email
Jul 1, 2009
9:17 pm

... brand new..? Well, there have been the usual updates to the perl modules, but I have been running apache::asp on the site since ~2000. But as I generally...
Andrew Koebrick (ADM)
Andrew.Koebrick@...
Send Email
Jul 2, 2009
6:29 pm

... Have you tried this patch: http://www.gossamer-threads.com/lists/modperl/asp/89060?search_string=yarrow;#89060 ? ... To unsubscribe, e-mail:...
Warren Young
warren@...
Send Email
Jul 2, 2009
8:34 pm

It looks like I figured out my problem with the missing $Request->Form data. I have RequestBinaryRead set to "Off". Turning this off gives me content in...
Andrew Koebrick (ADM)
Andrew.Koebrick@...
Send Email
Jul 7, 2009
8:03 pm

... The use of CGI.pm to construct file upload fields is a mere convenience. You can do the same thing by writing raw HTML. It's just uglier than the...
Warren Young
warren@...
Send Email
Jul 7, 2009
8:50 pm

Probably not what is causing your scenario but... I once had a scenario similar to this and found the problem was in my HTML. I needed to use both "id" and...
D. L. Fox
webdev@...
Send Email
Jul 3, 2009
3:34 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help