From: Cash Costello Date: Fri, 26 Jun 2009 11:41:28 +0000 (+0000) Subject: download image doesn't display now X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=ea636d9fbc60dbd54cd4f8ca271fd845361a2726;p=lorea%2Felgg.git download image doesn't display now --- 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;