From 63c00e64d2ef3bc06ce0d364d9b66373dfcd06a8 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 7 Oct 2021 20:03:12 +0200 Subject: [PATCH] Fixed filesize sometimes zero --- application/File/FileController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/application/File/FileController.php b/application/File/FileController.php index e0ee74be0..f8e75739d 100644 --- a/application/File/FileController.php +++ b/application/File/FileController.php @@ -52,14 +52,17 @@ class FileController extends mfBaseController { if (!$fh = fopen($file, 'r')) { return false; } - + set_time_limit(36000); header('Content-Type: application/octet-stream'); header('Content-disposition: attachment; filename="' . $name . '"'); $size = exec('stat -c %s '.escapeshellarg($file)); - if($size < (pow(2,31))-1) { - header('Content-Length: ' . $size); + + if(strlen($size)) { + if($size < (pow(2,31))-1) { + header('Content-Length: ' . $size); + } } while (!feof($fh)) {