aboutsummaryrefslogtreecommitdiff
path: root/actions/download.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/download.php')
-rw-r--r--actions/download.php17
1 files changed, 6 insertions, 11 deletions
diff --git a/actions/download.php b/actions/download.php
index fd23a21a7..3b39c831d 100644
--- a/actions/download.php
+++ b/actions/download.php
@@ -8,27 +8,22 @@
$file_guid = (int) get_input("file_guid");
$file = get_entity($file_guid);
-
- if ($file)
- {
+
+ if ($file) {
$filename = $file->originalfilename;
$mime = $file->mimetype;
header("Content-type: $mime");
- if (strpos($mime, "image/")!==false)
- header("Content-Disposition: inline; filename=\"$filename\"");
- else
- header("Content-Disposition: attachment; filename=\"$filename\"");
+ header("Content-Disposition: attachment; filename=\"$filename\"");
-
+
$readfile = new ElggFile($file_guid);
$readfile->owner_guid = $file->owner_guid;
- //$readfile->setFilename($filename);
-
+
$contents = $readfile->grabFile();
if (empty($contents))
- echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/icons/general.jpg" );
+ echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/image_error_large.png" );
else
echo $contents;