Permalink
Browse files

X-Accel-Redirect implementation;

Fixes #6;
  • Loading branch information...
1 parent eefb361 commit 86623cf67dbb2723ce28dffa7d2a708f8d1bc7a2 Alexander Kuznecov committed Apr 5, 2012
Showing with 9 additions and 1 deletion.
  1. +6 −1 system/Controller/Download.php
  2. +3 −0 system/config.ini
@@ -22,7 +22,12 @@ public function index() {
header ("Content-Length: " . filesize($file));
header ("Content-Disposition: attachment; filename=" . $filename);
- readfile($file);
+ if ($this->registry["server"]["nginx_accel_redirect"] == true) {
+ header("X-Accel-Redirect: /upload/" . $fn);
+ }
+ else {
+ readfile($file);
+ }
} else {
echo $this->view->render("fileNotExist", array());
}
View
@@ -20,3 +20,6 @@ host = "localhost"
username = ""
password = ""
dbname = ""
+
+[server]
+nginx_accel_redirect = false

0 comments on commit 86623cf

Please sign in to comment.