From 4d950355189b82461227eab069b8d2e8f14e1fb3 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 6 May 2005 09:31:45 +0000 Subject: - Patch #22118 by Robin Monks: made file_transfer() more robust. --- includes/file.inc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'includes') diff --git a/includes/file.inc b/includes/file.inc index 8126a772b..6c29a1725 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -442,11 +442,15 @@ function file_transfer($source, $headers) { $source = file_create_path($source); // Transfer file in 1024 byte chunks to save memory usage. - $fd = fopen($source, 'rb'); - while (!feof($fd)) { - print fread($fd, 1024); + if ($fd = fopen($source, 'rb')) { + while (!feof($fd)) { + print fread($fd, 1024); + } + fclose($fd); + } + else { + drupal_not_found(); } - fclose($fd); exit(); } -- cgit v1.2.3