check_canattach($session, $final_filename, $tempfile);
};
if ($@) {
- json_response($q, $form, $dest."/".$filename, $@);
- error $@;
+ # save error in case called functions clobber $@
+ my $error = $@;
+ json_response($q, $form, $dest."/".$filename, $error);
+ error $error;
}
# Move the attachment into holding directory.