diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index 6e25c0fbdb..b599e78a39 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -223,9 +223,6 @@ function send_file_to_browser($attachment, $category) } } - // Close the db connection before sending the file etc. - file_gc(false); - if (!set_modified_headers($attachment['filetime'], $user->browser)) { if ($size) @@ -238,6 +235,9 @@ function send_file_to_browser($attachment, $category) $fp = $storage->read_stream($filename); + // Close the db connection before sending the file etc. + file_gc(false); + if ($fp !== false) { $output = fopen('php://output', 'w+b');