Scenario: store a picture in FAL, and retrieve file name using standard sql statement
A) TCA declaration is as follows:
‘news_picture’ => array(
‘exclude’ => 0,
‘label’ => ‘LLL:EXT:mynews/Resources/Private/Language/Database.xlf:tx_mynews.news_picture’,
‘config’ => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
‘news_picture’,
array(
‘appearance’ => array(
‘collapseAll’ => TRUE
),
‘maxitems’ => 1,
)
)
),
B) An SQL example:
SELECT * FROM (
SELECT 
tx_mynews.uid as news_uid,
tx_mynews.news_title,
tx_mynews.news_subtitle,
`sys_file`.name AS filename,
`sys_file`.uid AS fileuid,
`sys_file`.identifier
FROM `tx_mynews` 
LEFT JOIN `sys_file_reference` ON 
`tx_mynews`.`uid` = `sys_file_reference`.`uid_foreign`
AND 
 `sys_file_reference`.`tablenames` = ‘tx_mynews’ 
 AND 
 `sys_file_reference`.`fieldname` = ‘news_picture’
 AND 
 `sys_file_reference`.`table_local` = ‘sys_file’ AND
 `sys_file_reference`.`deleted` = 0
LEFT JOIN `sys_file` 
ON
`sys_file_reference`.`uid_local` = `sys_file`.`uid`)
AS docs where docs.filename <> ”
ORDER BY news_title
LIMIT 100

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark