diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-05-06 09:31:45 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-05-06 09:31:45 +0000 |
commit | 4d950355189b82461227eab069b8d2e8f14e1fb3 (patch) | |
tree | 86c479ad7918b71b15232415a482b7d0670154c7 /includes | |
parent | 03250bd3e3146b1bf8b9bb356fcb0dc621ac92b2 (diff) | |
download | brdo-4d950355189b82461227eab069b8d2e8f14e1fb3.tar.gz brdo-4d950355189b82461227eab069b8d2e8f14e1fb3.tar.bz2 |
- Patch #22118 by Robin Monks: made file_transfer() more robust.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/file.inc | 12 |
1 files changed, 8 insertions, 4 deletions
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(); } |