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

View File

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