Re: [Arsperl-users] <No Subject>
Brought to you by:
jeffmurphy
|
From: Mark V. <mar...@co...> - 2008-09-26 16:18:32
|
Steve,
I am not a CGI person, but I see something which makes me think.
After you strip the remote directory from the filename ($v), the stat($v)
command is looking for the file in the local directory. It appears the file
is still in the remote directory ($u). Therefore, stat($v) will not find
the file and should return an empty array. This makes $s[7] undefined and
triggers the ERROR you see.
A suggestion would be to use stat($u) to look at the original file.
HTH,
Mark Vaughan
_____
From: Steve McDonald [mailto:ste...@ch...]
Sent: Thursday, September 25, 2008 5:16 PM
To: ARSperl User Discussion
Subject: [Arsperl-users] <No Subject>
I'm still trying to get attachments working.
What does this mean:
[ERROR] 'size' key does not map to scalar value. (ARERR #80025)
It happens as a result of this code:
my $ctrl; my $schema = "HelpDesk-Data and Channel Management";
my %fldtab;
if(($name && $email && $phone && $code && $reqcat && $reqtyp && $desc) ||
$reqid) {
$ctrl = ars_Login("suncoast", "dcm-web", "dcmweb");
if(!$ctrl) { $err="Cannot login to remedy server - $ars_errstr"; }
else {
%fldtab = ars_GetFieldTable($ctrl, $schema);
if(!%fldtab) { $err="Cannot get field table from remedy - $ars_errstr"; }
}
}
if(!$err && $name && $email && $phone && $code && $reqcat && $reqtyp &&
$desc) {
my @fields = ();
push(@fields, 7, 0);
push(@fields, 8, 'Submitted via web, please supply a proper description');
push(@fields, 536870931, $code);
push(@fields, 536871062, $name);
push(@fields, 536871065, $phone);
push(@fields, 536871067, $email);
push(@fields, 536871089, $desc);
push(@fields, 100000014, $reqcat);
push(@fields, 100000039, $reqtyp);
my @fieldids = (950000008,950000009,950000010,950001021);
my $k;
for $k($cgi->param) {
if(substr($k,0,6) eq 'attach') {
my $u=$cgi->upload($k);
my $v=$cgi->param($k);
$v=~m/^.*( <file:///\\|\)(.*)\> \\|\/)(.*)/; # strip the remote path and
keep the filename
$v=$2;
my @s=stat($v);
my %f=(file => $u, name => $v, size => $s[7]);
push(@fields, shift(@fieldids), \%f);
}
}
$submittedreqid = ars_CreateEntry($ctrl, $schema, @fields);
if(!$submittedreqid) { $err="Cannot create remedy ticket - $ars_errstr"; }
}
|