[TYPO3-dev] [FAL] How to store a file in Storage?
Sebastian Michaelsen
sebastian.gebhard at gmail.com
Thu Aug 2 16:07:00 CEST 2012
Am 27/07/2012 15:30, schrieb Sebastian Michaelsen:
> I tried this:
>
> $storageRepository =
> $objectManager->get('t3lib_file_Repository_StorageRepository');
>
> $fileStorage = $storageRepository->findByUid(2);
>
> $fileObject = $fileStorage->createFile($filename,
> $fileStorage->getDefaultFolder());
I think I'm one step further now but I'm still failing to create the
file properly. This what I do now:
$fileFactory = $objectManager->get('t3lib_file_Factory');
$fileStorage = $fileFactory->getStorageObject(2);
$fileObject = $fileStorage->createFile($filename,
$fileStorage->getDefaultFolder());
$fileStorage->setFileContents($fileObj, $content);
The empty file is created in the right directory, but setFileContents()
fails with this exception:
Updating file "/_temp_/filename" not allowed for user.
Any hints appreciated, thanks.
More information about the TYPO3-dev
mailing list