Neos\Flow\ResourceManagement\PersistentResource::setFileSize PHP Метод

setFileSize() публичный Метод

Sets the size of the content of this resource
public setFileSize ( integer $fileSize ) : void
$fileSize integer The content size
Результат void
    public function setFileSize($fileSize)
    {
        $this->throwExceptionIfProtected();
        $this->fileSize = $fileSize;
    }

Usage Example

 /**
  * Imports the given temporary file into the storage and creates the new resource object.
  *
  * Note: the temporary file is (re-)moved by this method.
  *
  * @param string $temporaryPathAndFileName
  * @param string $collectionName
  * @return PersistentResource
  * @throws StorageException
  */
 protected function importTemporaryFile($temporaryPathAndFileName, $collectionName)
 {
     $this->fixFilePermissions($temporaryPathAndFileName);
     $sha1Hash = sha1_file($temporaryPathAndFileName);
     $targetPathAndFilename = $this->getStoragePathAndFilenameByHash($sha1Hash);
     if (!is_file($targetPathAndFilename)) {
         $this->moveTemporaryFileToFinalDestination($temporaryPathAndFileName, $targetPathAndFilename);
     } else {
         unlink($temporaryPathAndFileName);
     }
     $resource = new PersistentResource();
     $resource->setFileSize(filesize($targetPathAndFilename));
     $resource->setCollectionName($collectionName);
     $resource->setSha1($sha1Hash);
     $resource->setMd5(md5_file($targetPathAndFilename));
     return $resource;
 }