From 9edd7eb5f68cf3e7e5a783d6f6c3bc758ebe1350 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 18 Oct 2019 15:30:49 +0200 Subject: [inc/Util] Simplify user download function --- inc/util.inc.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'inc/util.inc.php') diff --git a/inc/util.inc.php b/inc/util.inc.php index 3d912f80..c33bbc83 100644 --- a/inc/util.inc.php +++ b/inc/util.inc.php @@ -381,19 +381,8 @@ SADFACE; } Header('Content-Type: application/octet-stream', true); Header('Content-Disposition: attachment; filename=' . str_replace(array(' ', '=', ',', '/', '\\', ':', '?'), '_', iconv('UTF-8', 'ASCII//TRANSLIT', $name))); - Header('Content-Length: ' . @filesize($file)); - while (!feof($fh)) { - $data = fread($fh, 16000); - if ($data === false) { - echo "\r\n\nDOWNLOAD INTERRUPTED!\n"; - if ($delete) - @unlink($file); - return true; - } - echo $data; - @ob_flush(); - @flush(); - } + Header('Content-Length: ' . filesize($file)); + fpassthru($fh); fclose($fh); if ($delete) { unlink($file); -- cgit v1.2.3-55-g7522