aboutsummaryrefslogtreecommitdiffstats
path: root/mod/attach.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/attach.php')
-rw-r--r--mod/attach.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/mod/attach.php b/mod/attach.php
index 8676baa58..2c4f06c00 100644
--- a/mod/attach.php
+++ b/mod/attach.php
@@ -17,10 +17,17 @@ function attach_init(&$a) {
return;
}
+ $c = q("select channel_address from channel where channel_id = %d limit 1",
+ intval($r[0]['uid'])
+ );
+
+ if(! $c)
+ return;
+
header('Content-type: ' . $r['data']['filetype']);
header('Content-disposition: attachment; filename=' . $r['data']['filename']);
if($r['data']['flags'] & ATTACH_FLAG_OS ) {
- $stream = fopen($r['data']['data'],'rb');
+ $stream = fopen('store/' . $c[0]['channel_address'] . '/' . $r['data']['data'],'rb');
if($stream) {
pipe_stream($stream,STDOUT);
fclose($stream);