Fixed filesize sometimes zero

This commit is contained in:
Frank Schubert
2021-10-07 20:03:12 +02:00
parent d150b4e7b5
commit 63c00e64d2

View File

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