Neos\Flow\ResourceManagement\Storage\WritableFileSystemStorage::importResourceFromContent PHP Метод

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

On a successful import this method returns a PersistentResource object representing the newly imported persistent resource. The specified filename will be used when presenting the resource to a user. Its file extension is important because the resource management will derive the IANA Media Type from it.
public importResourceFromContent ( string $content, string $collectionName ) : PersistentResource
$content string The actual content to import
$collectionName string Name of the collection the new PersistentResource belongs to
Результат Neos\Flow\ResourceManagement\PersistentResource A resource object representing the imported resource
    public function importResourceFromContent($content, $collectionName)
    {
        $temporaryTargetPathAndFilename = $this->environment->getPathToTemporaryDirectory() . uniqid('TYPO3_Flow_ResourceImport_');
        try {
            file_put_contents($temporaryTargetPathAndFilename, $content);
        } catch (\Exception $exception) {
            throw new StorageException(sprintf('Could import the content stream to temporary file "%s".', $temporaryTargetPathAndFilename), 1381156098);
        }
        return $this->importTemporaryFile($temporaryTargetPathAndFilename, $collectionName);
    }