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

@ -161,6 +161,13 @@ class File extends Controller
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename={$name}");
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 ();
$x = @readfile($path);
if ($x === FALSE)