[TYPO3-dev] [FAL] How to store a file in Storage?

Sebastian Michaelsen sebastian.gebhard at gmail.com
Fri Jul 27 15:30:27 CEST 2012


Hi dev.*,

I'm trying to find my way trough the new file abstraction layer and 
struggle to create a new file:

I tried this:

$storageRepository = 
$objectManager->get('t3lib_file_Repository_StorageRepository');

$fileStorage = $storageRepository->findByUid(2);

$fileObject = $fileStorage->createFile($filename, 
$fileStorage->getDefaultFolder());

But I always get this error: Creating file /_temp_/filename failed.

FAL fails to prepend the path with PATH_site here.
I digged around with xdebug and found out that paths are initialized in 
the constructor of t3lib_file_Storage and IIRC, when you get an Object 
from a Repository the constructor is not called. So I guess that's why 
it fails.

Any hints how I can properly initialize my Storage object?

Thanks and kind regards,
Sebastian



More information about the TYPO3-dev mailing list