enable CardFortress in test database, #71513
[freeside.git] / httemplate / view / attachment.html
1 <%init>
2 $FS::CurrentUser::CurrentUser->access_right('Download attachment')
3   or die 'access denied';
4
5 my ($query) = $cgi->keywords;
6 $query =~ /^(\d+)$/;
7 my $attachnum = $1 or die 'Invalid attachment number';
8 my $attach = qsearchs('cust_attachment', { attachnum => $attachnum })
9   or die "Attachment not found: $attachnum";
10 die 'access denied' if $attach->disabled;
11
12 $r->subprocess_env('no-gzip' => 1); # disable mod_deflate
13
14 $m->clear_buffer;
15
16 $r->content_type($attach->mime_type || 'text/plain');
17
18 my $filename = $attach->filename;
19 $filename =~ s/"/'/g; #no idea how to encode " ... \" ?  "" ?  can't?
20 $r->headers_out->add(
21   'Content-Disposition' => qq(attachment;filename="$filename")
22 );
23
24 $m->print($attach->body);
25
26 </%init>