blob: 5fc053967f9e3d3d4b06c697f4941bbd6a8cd0c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<% $attach->body %>
<%init>
my ($query) = $cgi->keywords;
$query =~ /^(\d+)$/;
my $attachnum = $1 or die 'Invalid attachment number';
$FS::CurrentUser::CurrentUser->access_right('Download attachment') or die 'access denied';
my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die "Attachment not found: $attachnum";
die 'access denied' if $attach->disabled;
$m->clear_buffer;
$r->content_type($attach->mime_type || 'text/plain');
$r->headers_out->add('Content-Disposition' => 'attachment;filename=' . $attach->filename);
</%init>
|