added content-length to file download

This commit is contained in:
hyung-hwan 2011-12-22 05:45:48 +00:00
parent d47c681629
commit 2334333c53

View File

@ -36,7 +36,7 @@ class File extends Controller
{ {
$data['message'] = 'DATABASE ERROR'; $data['message'] = 'DATABASE ERROR';
$this->load->view ($this->VIEW_ERROR, $data); $this->load->view ($this->VIEW_ERROR, $data);
} }
else if ($project === NULL) else if ($project === NULL)
{ {
$data['message'] = $data['message'] =
@ -161,6 +161,13 @@ class File extends Controller
header("Content-Type: application/octet-stream"); header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename={$name}"); header("Content-Disposition: attachment; filename={$name}");
header("Content-Transfer-Encoding: binary"); header("Content-Transfer-Encoding: binary");
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
$fsize = @filesize($path);
if ($fsize !== FALSE) header("Content-Length: {$fsize}");
flush (); flush ();
$x = @readfile($path); $x = @readfile($path);
if ($x === FALSE) if ($x === FALSE)