http://qs1969.pair.com?node_id=295339

jerrygarciuh has asked for the wisdom of the Perl Monks concerning the following question:

Hello all,

I got roped into coding some stuff for a IIs box, bleah. My normal file upload routine is getting the error

Undefined subroutine CGI::upload

The eversion for CGI is 2.46 but from reading the revision history it does not appear that should be the issue. I can't get the folks running the box to answer any questions so far.

Anyone have any advice? Code is below.
TIA
jg

#!/usr/local/bin/perl -w use strict; use CGI::Carp qw/fatalsToBrowser /; use CGI qw/:standard /; my $q = CGI->new(); my $user_pass = $q->param('pass'); my $target_directory = "c:\\rediculousIIsServer\\yata"; if ($user_pass eq 'somePass') { file_up(); } else { print $q->header, start_html, h2('Bad Password=', $user_pass); exit; } sub file_up { my $corrected_filename = $q->param('temp_filename'); $corrected_filename =~ s/ /_/g; local $| = 1; my ($bytesread,$buffer,$file); my $fh = $q->upload('temp_filename'); open(OUTF, '>' . $target_directory . $corrected_filename); while ($bytesread = read($fh, $buffer, 1024)) { print(OUTF $buffer); } close(OUTF); if (!$file && $q->cgi_error) { print($q->header(-status=>$q->cgi_error)); exit 0; } my $redir = "http://www.thesite.com/done.htm"; print $q->redirect("$redir"); }
_____________________________________________________
"The man who grasps principles can successfully select his own methods.
The man who tries methods, ignoring principles, is sure to have trouble.
~ Ralph Waldo Emerson