From cff7056f8ff809251448de269bbc5e13780f35de Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 11 Jan 2014 12:58:00 -0800 Subject: mod_attach: output stream wasn't working --- mod/attach.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/attach.php b/mod/attach.php index 7371f0367..c52966ce0 100644 --- a/mod/attach.php +++ b/mod/attach.php @@ -27,10 +27,12 @@ function attach_init(&$a) { header('Content-type: ' . $r['data']['filetype']); header('Content-disposition: attachment; filename=' . $r['data']['filename']); if($r['data']['flags'] & ATTACH_FLAG_OS ) { - $stream = fopen('store/' . $c[0]['channel_address'] . '/' . $r['data']['data'],'rb'); - if($stream) { - pipe_stream($stream,STDOUT); - fclose($stream); + $istream = fopen('store/' . $c[0]['channel_address'] . '/' . $r['data']['data'],'rb'); + $ostream = fopen('php://output','wb'); + if($istream && $ostream) { + pipe_streams($istream,$ostream); + fclose($istream); + fclose($ostream); } } else -- cgit v1.2.3