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...
Message search is now enhanced, find messages faster. Take it for a spin.

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 #2268 of 2277 |

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 recommendation is to roll back to CGI v2.78.  This is not an option in my case- I am locked into 3.43.  I am hoping that somebody can offer suggestions on patching either apache::asp or CGI to get my script to function.  I am adapting the  upload script from here, and it looks pretty straight forward:

http://www.sitepoint.com/article/uploading-files-cgi-perl/

 

Unfortunately, when I run the script, I end up with an empty file on my server.  I have edited CGI.pm to use an appropriate $CGITempFile::TMPDIRECTORY

 

Some other potentially relevant specs: Fedora 10, Apache/2.2.11 (Unix) mod_perl/2.0.4 Perl/v5.10.0

 

Also, as another potential clue, I found which attempting to debug that I seem to have an empty request object… If I try to read directly from request->Form I get the error:

 

Can't locate object method "request" via package "Apache" at /home/httpd/html-MBA/Users/InputForms/Me

taManager4.html line 93. <--> , /usr/local/lib/perl5/site_perl/5.10.0/Apache/ASP.pm line 1522

 

Also, when I attempt to test the upload script from http://www.apache-asp.org/eg/file_upload.asp on my own server, I again seem to be stymied by the missing request object.

 

Many thanks for assisting in sorting this issue out.

 

 

Andrew Koebrick

 

++++++++++++++

Problem script:

 

                        my $safe_filename_characters = "a-zA-Z0-9_.-";

                        my $upload_dir = "$ENV{DOCUMENT_ROOT}/$cfg->{DocumentStore}";

 

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

                                               

                        if ( !$filename )

                        {

                         print $query->header ( );

                         print "There was a problem uploading your photo (try a smaller file).";

                         exit;

                        }

                       

                        my ( $name, $path, $extension ) = fileparse ( $filename, '\..*' );

                        $filename = $name . $extension;

                        $filename =~ tr/ /_/;

                        $filename =~ s/[^$safe_filename_characters]//g;

                       

                        if ( $filename =~ /^([$safe_filename_characters]+)$/ )

                        {

                         $filename = $1;

                        }

                        else

                        {

                         die "Filename contains invalid characters";

                        }

                       

 

 

                       

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

                        print "Location $upload_dir/$filename";

                        open ( UPLOADFILE, ">/home/httpd/html-MBA/$filename" ) or die "$!";

                        binmode UPLOADFILE;

                        while ( <$upload_filehandle> )

                        {

                         print UPLOADFILE;

                        }

                       

                        close UPLOADFILE;

 



Tue Jun 30, 2009 9:50 pm

Andrew.Koebrick@...
Send Email Send Email

Forward
Message #2268 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