From cc8554abadc047469087fcd4f8f469ba733fceb0 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 31 Dec 2010 15:47:41 +0000 Subject: file index page now working for both users and groups git-svn-id: http://code.elgg.org/elgg/trunk@7790 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/file/download.php | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'mod/file/download.php') diff --git a/mod/file/download.php b/mod/file/download.php index d7625901e..a386d490f 100644 --- a/mod/file/download.php +++ b/mod/file/download.php @@ -11,32 +11,30 @@ $file_guid = get_input("file_guid"); // Get the file $file = get_entity($file_guid); +if (!$file) { + register_error(elgg_echo("file:downloadfailed")); + forward(); +} -if ($file) { - $mime = $file->getMimeType(); - if (!$mime) { - $mime = "application/octet-stream"; - } - - $filename = $file->originalfilename; +$mime = $file->getMimeType(); +if (!$mime) { + $mime = "application/octet-stream"; +} - // fix for IE https issue - header("Pragma: public"); +$filename = $file->originalfilename; - header("Content-type: $mime"); - if (strpos($mime, "image/") !== false) { - header("Content-Disposition: inline; filename=\"$filename\""); - } else { - header("Content-Disposition: attachment; filename=\"$filename\""); - } +// fix for IE https issue +header("Pragma: public"); - $contents = $file->grabFile(); - $splitString = str_split($contents, 8192); - foreach ($splitString as $chunk) { - echo $chunk; - } - exit; +header("Content-type: $mime"); +if (strpos($mime, "image/") !== false) { + header("Content-Disposition: inline; filename=\"$filename\""); } else { - register_error(elgg_echo("file:downloadfailed")); - forward(); -} \ No newline at end of file + header("Content-Disposition: attachment; filename=\"$filename\""); +} + +$contents = $file->grabFile(); +$splitString = str_split($contents, 8192); +foreach ($splitString as $chunk) { + echo $chunk; +} -- cgit v1.2.3