--- Ryan Davis <[EMAIL PROTECTED]> wrote:
> Hey everyone, here's my problem:
> 
> I have a script to take information and put it in a database, and also upload a 
>resume.  The
> entire thing works on my test machine (Win98/Activeperl/Apache) but doesn't work on 
>my actual
> machine (Digital Unix/Perl5+/Apache).  
> 
> I've attached the entire script, but the relevant parts are copied here:

Ryan,

Off the top of my head, I don't know what's causing your problem.  It would help if 
you posted the
error message you're getting, if any.

Is there any chance that someone has disabled uploads in CGI.pm?  Some people do that 
as a
security measure.  Open CGI.pm and look for $CGI::DISABLE_UPLOADS.  If it's set to a 
true value,
that's your problem.  At the top of your code, you'll need to set it to a false value 
*before* you
instantiate your CGI object.  You'll also want to see if someone has set the 
$CGI::POST_MAX
variable to a positive value.  If so, that value will be the maximum posting size, in 
bytes. 
You'll have to set that in your code, too.  

Also, I've had many, many problems with the $cgi->upload() method.  

Here's one thing you might try.  I recently wrote a CGI::Safe module.  It makes the CGI
environment a little safer to work with.  I also threw in a generic upload utility as 
so many
people have difficulties with this.  You can find this module at
http://206.170.14.76/index.pl?node_id=104626.

Here's how easy uploads are (note that you can even specify the mime type that you'll 
accept):

    use CGI::Safe;
    my $q = CGI::Safe->new( DISABLE_UPLOADS => 0,
                            POST_MAX        => 1024 * 1024 ); # allow 1 meg uploads

    my $file = $q->get_upload( file_name => 'resume',      # name of file
                               format    => 'Application/msword' ); # only allow Word 
docs

    if ( $file->{ error } ) {
       print $q->header,
             $q->start_html,
             $q->p( $file->{ error } ),
             $q->end_html;
    } else {
       print $q->header( -type => $file->{ format } ),
              $file->{ file };
    }
 
If this interests you, download the code (there's a download link at the bottom) and 
save it in
your perl/lib/CGI directory as 'Safe.pm'.  Full POD is included.  Just do 'perldoc 
CGI::Safe' for
complete information.  

I've only had one person send feedback so far, so I'm curious to know if others find 
it useful.

Cheers,
Curtis Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to