From 9713d38078e0354b47d12fb22af6d453c9941b40 Mon Sep 17 00:00:00 2001 From: Gamesh Date: Mon, 9 Dec 2013 08:53:11 +0200 Subject: [PATCH 1/2] [*] FO: now you can download files >1G without running into max execution limitation when reading large files ( >1G ), you often get max execution timeout error, this fix will prevent this. --- controllers/front/GetFileController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/front/GetFileController.php b/controllers/front/GetFileController.php index d89f6c109..84e1fdf16 100644 --- a/controllers/front/GetFileController.php +++ b/controllers/front/GetFileController.php @@ -278,6 +278,8 @@ class GetFileControllerCore extends FrontController header('Content-Type: '.$mimeType); header('Content-Length: '.filesize($file)); header('Content-Disposition: attachment; filename="'.$filename.'"'); + //prevents max execution timeout, when reading large files + set_time_limit(0); $fp = fopen($file, 'rb'); while (!feof($fp)) echo fgets($fp, 16384); From 5c496f45a12c297b06b8d83a8f9e6847df63d096 Mon Sep 17 00:00:00 2001 From: Gamesh Date: Mon, 9 Dec 2013 15:04:16 +0200 Subject: [PATCH 2/2] [*] FO: now you can download files >1G without running into max execution limitation Added @ to suppress warning i safe mode. --- controllers/front/GetFileController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/front/GetFileController.php b/controllers/front/GetFileController.php index 84e1fdf16..59500b213 100644 --- a/controllers/front/GetFileController.php +++ b/controllers/front/GetFileController.php @@ -279,7 +279,7 @@ class GetFileControllerCore extends FrontController header('Content-Length: '.filesize($file)); header('Content-Disposition: attachment; filename="'.$filename.'"'); //prevents max execution timeout, when reading large files - set_time_limit(0); + @set_time_limit(0); $fp = fopen($file, 'rb'); while (!feof($fp)) echo fgets($fp, 16384);