mod_attach: output stream wasn't working

This commit is contained in:
friendica
2014-01-11 12:58:00 -08:00
parent f125be846c
commit cff7056f8f
5 changed files with 14 additions and 6 deletions

View File

@@ -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