示例#1
0
 /**
  * @param CWebDavTmpFile $file
  * @param                $startRange
  * @param                $endRange
  * @param                $fileSize
  * @return bool
  * @throws WebDavTmpFileErrorException
  */
 private function internalAppendNonCloud(CWebDavTmpFile $file, $startRange, $endRange, $fileSize)
 {
     if (!$this->existsFile()) {
         throw new WebDavTmpFileErrorException('Append content. Not exists file (target)');
     }
     if (!$file->existsFile()) {
         throw new WebDavTmpFileErrorException('Append content. Not exists file');
     }
     $fp = fopen($this->getAbsolutePath(), 'ab');
     if (!$fp) {
         throw new WebDavTmpFileErrorException('Could not open file');
     }
     $appendContent = $file->getContent();
     if ($appendContent === false) {
         throw new WebDavTmpFileErrorException('Could not get contents file (target)');
     }
     if (fwrite($fp, $appendContent) === false) {
         throw new WebDavTmpFileErrorException('Error in fwrite (append)');
     }
     fclose($fp);
     return true;
 }