Perl question: Any step-by-step guide to file uploads under mod_perl?

yllus

Elite Member & Lifer
Aug 20, 2000
20,577
432
126
Forgive the on-topic post in OT, but I'd never get a reply in Software/Programming.

I'm having bad memory leak problems with the common CGI file upload script under mod_perl (a problem discussed here), and need a solution. Problem is that I can't really make heads or tails out of the official solution, or at least enough of it to make it work. My requirements:

- Work under mod_perl 1.xx.
- The ability to limit filesizes (100 kb is my currently used max).
- The ability to limit file types to a few image filetypes.

But really a simple working script would be wonderful. Any gurus got an idea?
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Well, I just breifly looked at the "official solution" that you included, and it seems like the "form" sub at the top of the page is simple enoguh to use.

$hashref = form();

Pretty simple. Have you actually tried that and had problems, or do you not know how to use a hashref, or what?
 

yllus

Elite Member & Lifer
Aug 20, 2000
20,577
432
126
Originally posted by: notfred
Well, I just breifly looked at the "official solution" that you included, and it seems like the "form" sub at the top of the page is simple enoguh to use.

$hashref = form();

Pretty simple. Have you actually tried that and had problems, or do you not know how to use a hashref, or what?
The error I'm currently getting reads:

Can't locate object method "new" via package "Apache::Request" (perhaps you forgot to load "Apache::Request"?) at test.pl line 26.

Apache::Request should be loaded - Request.pm is available in the proper directory and a use Apache::Request; statement is placed at the beginning of the script. Any tips?
 

yllus

Elite Member & Lifer
Aug 20, 2000
20,577
432
126
Originally posted by: notfred
Your Apache::Request module appears to be broken.
That's not good. Any alternatives/fixes?