3 my ($query) = $cgi->keywords;
5 my $attachnum = $1 or die 'Invalid attachment number';
6 $FS::CurrentUser::CurrentUser->access_right('Download attachment') or die 'access denied';
8 my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die "Attachment not found: $attachnum";
9 die 'access denied' if $attach->disabled;
12 $r->content_type($attach->mime_type || 'text/plain');
13 $r->headers_out->add('Content-Disposition' => 'attachment;filename=' . $attach->filename);