D
Darren Clark
I'm fairly new to writing Perl CGI Scripts. The script I've written
uploads a file to a web server. The script runs fine when I am using
IE from a windows machine, but when I use a MAC to call the script, I
get the following error message:
Undefined subroutine &main::Error called at
/home/comp/corp/ici1/www/scripts/upload.cgi line 28.
Program returned result 21. A value larger than 0 is an error.
The following is my script:
#!/bin/perl
# use strict;
use CGI ':standard';
#Define variables
$query = new CGI;
my $name= $query->param('u_file');
my $workorder= $query->param('work_order');
my $info= uploadInfo ($name);
my $type = $info -> {'Content-Type'};
$mypath = '../upload/'.$workorder;
#Create upload directory
# mkdir ($mypath, 0777);
#Strip directory structure
$name=~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the
filename
my $newname = $2;
# Concatenate the path & file name for UPLOAD
$myupload = '>'.$mypath.'/'.$newname;
if ($name) {
open (UPLOAD, $myupload) || Error ();
my ($data, $chunk);
while ($chunk = read ($name, $data, 1024)) {
print UPLOAD $data;
}
close (UPLOAD);
}
I assume it has something to do with how a MAC passess the file
information that is being uploaded but am not sure if I am right or if
I am how to correct it. I've scoured the web and have come up with
nothing.
I'd appreciate it if someone could give me some direction.
Please reply to darren.clark@{no spam}clarkcompservice.com
Thank you,
Darren
uploads a file to a web server. The script runs fine when I am using
IE from a windows machine, but when I use a MAC to call the script, I
get the following error message:
Undefined subroutine &main::Error called at
/home/comp/corp/ici1/www/scripts/upload.cgi line 28.
Program returned result 21. A value larger than 0 is an error.
The following is my script:
#!/bin/perl
# use strict;
use CGI ':standard';
#Define variables
$query = new CGI;
my $name= $query->param('u_file');
my $workorder= $query->param('work_order');
my $info= uploadInfo ($name);
my $type = $info -> {'Content-Type'};
$mypath = '../upload/'.$workorder;
#Create upload directory
# mkdir ($mypath, 0777);
#Strip directory structure
$name=~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the
filename
my $newname = $2;
# Concatenate the path & file name for UPLOAD
$myupload = '>'.$mypath.'/'.$newname;
if ($name) {
open (UPLOAD, $myupload) || Error ();
my ($data, $chunk);
while ($chunk = read ($name, $data, 1024)) {
print UPLOAD $data;
}
close (UPLOAD);
}
I assume it has something to do with how a MAC passess the file
information that is being uploaded but am not sure if I am right or if
I am how to correct it. I've scoured the web and have come up with
nothing.
I'd appreciate it if someone could give me some direction.
Please reply to darren.clark@{no spam}clarkcompservice.com
Thank you,
Darren