aboutsummaryrefslogtreecommitdiff
path: root/actions/download.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-10-03 19:26:12 +0000
committerCash Costello <cash.costello@gmail.com>2009-10-03 19:26:12 +0000
commit9b3cba566de0bc5740e48f3f50eb8b09ffad49dc (patch)
tree13d8925fb44ef24782a6a211642637ee43431e89 /actions/download.php
parenta587ad4ed1867743ea9e698f98a156f4f763e86a (diff)
downloadelgg-9b3cba566de0bc5740e48f3f50eb8b09ffad49dc.tar.gz
elgg-9b3cba566de0bc5740e48f3f50eb8b09ffad49dc.tar.bz2
allowing browser to cache photos now
Diffstat (limited to 'actions/download.php')
-rw-r--r--actions/download.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/actions/download.php b/actions/download.php
index 0f9835e11..b382c56bc 100644
--- a/actions/download.php
+++ b/actions/download.php
@@ -16,7 +16,7 @@
$filename = $file->originalfilename;
$mime = $file->mimetype;
- header("Content-type: $mime");
+ header("Content-Type: $mime");
if ($view == "inline")
header("Content-Disposition: inline; filename=\"$filename\"");
else
@@ -28,10 +28,21 @@
$contents = $readfile->grabFile();
- if (empty($contents))
+ if (empty($contents)) {
echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/image_error_large.png" );
- else
+ } else {
+
+ // expires every 60 days
+ $expires = 60 * 60*60*24;
+
+ header("Content-Length: " . strlen($contents));
+ header("Cache-Control: public", true);
+ header("Pragma: public", true);
+ header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
+
+
echo $contents;
+ }
exit;
}