aboutsummaryrefslogtreecommitdiff
path: root/mod/file/download.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-31 15:47:41 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-31 15:47:41 +0000
commitcc8554abadc047469087fcd4f8f469ba733fceb0 (patch)
treea9837273d0142dfc649feb2b031158db4105a4f9 /mod/file/download.php
parent24ef7261d523155ee1c58e8297516e726b4ce80b (diff)
downloadelgg-cc8554abadc047469087fcd4f8f469ba733fceb0.tar.gz
elgg-cc8554abadc047469087fcd4f8f469ba733fceb0.tar.bz2
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
Diffstat (limited to 'mod/file/download.php')
-rw-r--r--mod/file/download.php46
1 files changed, 22 insertions, 24 deletions
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;
+}