From 6eda8064449d154614345e9bd867dce2faba0deb Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 8 Jan 2014 18:06:52 -0800 Subject: This should be approaching completion for file OS storage. May be a few minor bugs remaining due to some late-breaking fixes but I've been testing it as I go. --- mod/attach.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'mod') 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); -- cgit v1.2.3