diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-29 13:35:16 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-29 13:35:16 +0000 |
commit | 8f7a86ebae5f6fd3f64f976a83cfc6712e083c2a (patch) | |
tree | 0b8c15acc290f4c5e2c34f105df63e9ede224a6a /mod/file/actions/file/download.php | |
parent | 81a0698f97c9e92639109caa5215a503b823b968 (diff) | |
download | elgg-8f7a86ebae5f6fd3f64f976a83cfc6712e083c2a.tar.gz elgg-8f7a86ebae5f6fd3f64f976a83cfc6712e083c2a.tar.bz2 |
starting to update the file plugin to use the new html/css
git-svn-id: http://code.elgg.org/elgg/trunk@7737 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/file/actions/file/download.php')
-rw-r--r-- | mod/file/actions/file/download.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/mod/file/actions/file/download.php b/mod/file/actions/file/download.php new file mode 100644 index 000000000..210735b74 --- /dev/null +++ b/mod/file/actions/file/download.php @@ -0,0 +1,37 @@ +<?php + /** + * Elgg file browser download action. + * + * @package ElggFile + */ + + // Get the guid + $file_guid = get_input("file_guid"); + + // Get the file + $file = get_entity($file_guid); + + if ($file) + { + $mime = $file->getMimeType(); + if (!$mime) $mime = "application/octet-stream"; + + $filename = $file->originalfilename; + + // fix for IE https issue + header("Pragma: public"); + header("Content-type: $mime"); + if (strpos($mime, "image/")!==false) + header("Content-Disposition: inline; filename=\"$filename\""); + else + header("Content-Disposition: attachment; filename=\"$filename\""); + + $contents = $file->grabFile(); + $splitString = str_split($contents, 8192); + foreach($splitString as $chunk) + echo $chunk; + exit; + } + else + register_error(elgg_echo("file:downloadfailed")); +?>
\ No newline at end of file |