Check file handle exists before trying to read file

This commit is contained in:
Michael Gapczynski 2012-04-01 02:38:26 -04:00
parent daf742c086
commit 6bb48b2731
1 changed files with 9 additions and 6 deletions

View File

@ -137,13 +137,16 @@ class OC_FilesystemView {
}
public function readfile($path){
$handle=$this->fopen($path,'r');
$chunkSize = 1024*1024;// 1 MB chunks
while (!feof($handle)) {
echo fread($handle, $chunkSize);
@ob_flush();
flush();
if ($handle) {
$chunkSize = 1024*1024;// 1 MB chunks
while (!feof($handle)) {
echo fread($handle, $chunkSize);
@ob_flush();
flush();
}
return $this->filesize($path);
}
return $this->filesize($path);
return false;
}
public function is_readable($path){
return $this->basicOperation('is_readable',$path);