Lines 153-159
sub err {
Link Here
|
153 |
my $err; |
153 |
my $err; |
154 |
foreach my $f ( keys %{ $self->{files} } ) { |
154 |
foreach my $f ( keys %{ $self->{files} } ) { |
155 |
my $e = $self->{files}->{$f}->{errcode}; |
155 |
my $e = $self->{files}->{$f}->{errcode}; |
156 |
$err->{ $f } = $e if $e; |
156 |
my $etext = $self->{files}->{$f}->{errtext}; |
|
|
157 |
$err->{ $f }->{code} = $e if $e; |
158 |
$err->{ $f }->{text} = $etext; |
157 |
} |
159 |
} |
158 |
return $err; |
160 |
return $err; |
159 |
} |
161 |
} |
Lines 221-228
sub _create_file {
Link Here
|
221 |
#skip |
223 |
#skip |
222 |
} elsif( !$self->{temporary} && !$self->{rootdir} ) { |
224 |
} elsif( !$self->{temporary} && !$self->{rootdir} ) { |
223 |
$self->{files}->{$filename}->{errcode} = 3; #no rootdir |
225 |
$self->{files}->{$filename}->{errcode} = 3; #no rootdir |
|
|
226 |
$self->{files}->{$filename}->{errtext} = "Root directory for uploads not defined"; #no rootdir |
224 |
} elsif( $self->{temporary} && !$self->{tmpdir} ) { |
227 |
} elsif( $self->{temporary} && !$self->{tmpdir} ) { |
225 |
$self->{files}->{$filename}->{errcode} = 4; #no tempdir |
228 |
$self->{files}->{$filename}->{errcode} = 4; #no tempdir |
|
|
229 |
$self->{files}->{$filename}->{errtext} = "Temporary directory for uploads not defined"; #no tempdir |
226 |
} else { |
230 |
} else { |
227 |
my $dir = $self->_dir; |
231 |
my $dir = $self->_dir; |
228 |
my $hashval = $self->{files}->{$filename}->{hash}; |
232 |
my $hashval = $self->{files}->{$filename}->{hash}; |
Lines 236-241
sub _create_file {
Link Here
|
236 |
uploadcategorycode => $self->{category}, |
240 |
uploadcategorycode => $self->{category}, |
237 |
})->count ) { |
241 |
})->count ) { |
238 |
$self->{files}->{$filename}->{errcode} = 1; #already exists |
242 |
$self->{files}->{$filename}->{errcode} = 1; #already exists |
|
|
243 |
$self->{files}->{$filename}->{errtext} = "File already exists: $dir/$fn"; #already exists |
239 |
return; |
244 |
return; |
240 |
} |
245 |
} |
241 |
|
246 |
|
Lines 245-250
sub _create_file {
Link Here
|
245 |
$self->{files}->{$filename}->{fh}= $fh; |
250 |
$self->{files}->{$filename}->{fh}= $fh; |
246 |
} else { |
251 |
} else { |
247 |
$self->{files}->{$filename}->{errcode} = 2; #not writable |
252 |
$self->{files}->{$filename}->{errcode} = 2; #not writable |
|
|
253 |
$self->{files}->{$filename}->{errtext} = "Directory is not writeable: $dir"; #not writable |
248 |
} |
254 |
} |
249 |
} |
255 |
} |
250 |
return $fh; |
256 |
return $fh; |