diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-31 15:47:41 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-31 15:47:41 +0000 |
commit | cc8554abadc047469087fcd4f8f469ba733fceb0 (patch) | |
tree | a9837273d0142dfc649feb2b031158db4105a4f9 /mod/file/download.php | |
parent | 24ef7261d523155ee1c58e8297516e726b4ce80b (diff) | |
download | elgg-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.php | 46 |
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; +} |