summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-10-18 15:30:49 +0200
committerSimon Rettberg2019-10-18 15:30:49 +0200
commit9edd7eb5f68cf3e7e5a783d6f6c3bc758ebe1350 (patch)
tree982fb35d48f093ebca9bf0d227014bc17d44d926
parent[serversetup-bwlp-ipxe] UI/UX tweaks (diff)
downloadslx-admin-9edd7eb5f68cf3e7e5a783d6f6c3bc758ebe1350.tar.gz
slx-admin-9edd7eb5f68cf3e7e5a783d6f6c3bc758ebe1350.tar.xz
slx-admin-9edd7eb5f68cf3e7e5a783d6f6c3bc758ebe1350.zip
[inc/Util] Simplify user download function
-rw-r--r--inc/util.inc.php15
1 files changed, 2 insertions, 13 deletions
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);