2 my ($query) = $cgi->keywords;
4 my $attachnum = $1 or die 'Invalid attachment number';
5 $FS::CurrentUser::CurrentUser->access_right('Download attachment') or die 'access denied';
7 my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die 'Attachment not found: $attachnum';
10 $r->content_type($attach->mime_type || 'text/plain');
11 $r->headers_out->add('Content-Disposition' => 'attachment;filename=' . $attach->filename);
14 print STDOUT $attach->body;