diff options
Diffstat (limited to 'httemplate/view/attachment.html')
| -rw-r--r-- | httemplate/view/attachment.html | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/httemplate/view/attachment.html b/httemplate/view/attachment.html new file mode 100644 index 000000000..5827e3d20 --- /dev/null +++ b/httemplate/view/attachment.html @@ -0,0 +1,15 @@ +<%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; + +$r->subprocess_env('no-gzip' => 1); # disable mod_deflate +$m->clear_buffer; +$r->content_type($attach->mime_type || 'text/plain'); +$r->headers_out->add('Content-Disposition' => 'attachment;filename=' . $attach->filename); +$m->print($attach->body); +</%init> |
