Recommitting filesize checks in smartReadFile

This commit is contained in:
Duncan Sommerville 2015-02-03 16:33:48 -05:00
parent d5477dfb5b
commit 7eef9d941e
1 changed files with 11 additions and 3 deletions

View File

@ -158,7 +158,15 @@ class ApiController extends Zend_Controller_Action
throw new FileDoesNotExistException("Requested file does not exist!"); throw new FileDoesNotExistException("Requested file does not exist!");
} }
// If we're passing in a Stored File object, it's faster
// to use getFileSize() and pass in the result
if (!$size || $size <= 0) {
$size= filesize($location); $size= filesize($location);
}
if ($size <= 0) {
throw new Exception("Invalid file size returned for file at $location");
}
$fm = @fopen($location, 'rb'); $fm = @fopen($location, 'rb');
if (!$fm) { if (!$fm) {