CC-2317: Once uploaded, file size is different than original.

This commit is contained in:
Martin Konecny 2011-05-24 16:33:26 -04:00
parent ac952ad71e
commit 28a609c4dd
1 changed files with 51 additions and 50 deletions
airtime_mvc/application/controllers

View File

@ -85,8 +85,6 @@ class ApiController extends Zend_Controller_Action
exit; exit;
} }
// !! binary mode !!
$fp = fopen($filepath, 'rb');
// possibly use fileinfo module here in the future. // possibly use fileinfo module here in the future.
// http://www.php.net/manual/en/book.fileinfo.php // http://www.php.net/manual/en/book.fileinfo.php
@ -100,12 +98,15 @@ class ApiController extends Zend_Controller_Action
} }
header("Content-Length: " . filesize($filepath)); header("Content-Length: " . filesize($filepath));
//flush the file contents 16 KBytes at a time. In the future we may // !! binary mode !!
//want to use the "X-Sendfile header" method instead. $fp = fopen($filepath, 'rb');
while (!feof($fp)) {
echo fread($fp, 64*1024); //We can have multiple levels of output buffering. Need to
ob_end_flush(); //keep looping until all have been disabled!!!
} //http://www.php.net/manual/en/function.ob-end-flush.php
while (@ob_end_flush());
fpassthru($fp);
fclose($fp); fclose($fp);
return; return;