[TYPO3-dev] read elements from sysFolder

Jigal van Hemert jigal.van.hemert at typo3.org
Wed Nov 25 09:23:40 CET 2015


Hi,

On 25/11/2015 07:56, typo3 wrote:
> after long research i have to ask :-(
>
> how can i access any elements from directory from BE via php in extension?
>
> i need to read image elements, tried with FAL but if i dont know file
> name i cant get data

Not tested, but I would try it with:

$path = 'path/to/the/directory/';
$resourceFactory = 
GeneralUtility::makeInstance(TYPO3\CMS\Core\Resource\ResourceFactory::class);
$folder = $resourceFactory->retrieveFileOrFolderObject($path);
$files = $folder->getFiles($start = 0, $numberOfItems = 0, $filterMode = 
self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, $recursive = false, $sort 
= '', $sortRev = false);

Then you have an array of file objects and I assume that you can get the 
data you want from the files.

You can get a lot of inspiration from the filelist sysext.

-- 
Jigal van Hemert
TYPO3 CMS Active Contributor

TYPO3 .... inspiring people to share!
Get involved: typo3.org



More information about the TYPO3-dev mailing list