From ea636d9fbc60dbd54cd4f8ca271fd845361a2726 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 26 Jun 2009 11:41:28 +0000 Subject: download image doesn't display now --- actions/download.php | 17 ++++++----------- 1 file 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; -- cgit v1.2.3