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,6 +137,7 @@ class OC_FilesystemView {
}
public function readfile($path){
$handle=$this->fopen($path,'r');
if ($handle) {
$chunkSize = 1024*1024;// 1 MB chunks
while (!feof($handle)) {
echo fread($handle, $chunkSize);
@ -145,6 +146,8 @@ class OC_FilesystemView {
}
return $this->filesize($path);
}
return false;
}
public function is_readable($path){
return $this->basicOperation('is_readable',$path);
}