Typo3 类型3:文件上载和文件引用问题
我有一个带有“pdf”和“image”属性的“Book”模型。这两个属性都是用户可以上载的文件 我跟着上传了图片,效果很好。 我尝试对“pdf”字段执行相同的操作,但它不起作用。正在上载文件,文件ID也保存在数据库中,但缺少文件引用 以下是上载后“Book”对象的转储:Typo3 类型3:文件上载和文件引用问题,typo3,typoscript,fluid,Typo3,Typoscript,Fluid,我有一个带有“pdf”和“image”属性的“Book”模型。这两个属性都是用户可以上载的文件 我跟着上传了图片,效果很好。 我尝试对“pdf”字段执行相同的操作,但它不起作用。正在上载文件,文件ID也保存在数据库中,但缺少文件引用 以下是上载后“Book”对象的转储: pdf => NULL image => Vendor\MyExt\Domain\Model\FileReference 在“SetTypeConverterConfiguration for ImageUpl
pdf => NULL
image => Vendor\MyExt\Domain\Model\FileReference
在“SetTypeConverterConfiguration for ImageUpload”函数中,我添加了这一行pdf属性:
$newExampleConfiguration->forProperty('pdf')
->setTypeConverterOptions(
'Vendor\\MyExt\\Property\\TypeConverter\\UploadedFileReferenceConverter',
$uploadConfiguration
);
我可能错过了什么,但我不知道什么
编辑:
多亏了Heinz和Ghanshyam,我才发现了这个问题。这是TCA中的一个错误。
以下是我的工作TCA的样子:
'image' => array(
'exclude' => 1,
'label' => 'Image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('image', array(
'appearance' => array(
'elementBrowserType' => 'file',
'elementBrowserAllowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
),
'minitems' => 0,
'maxitems' => 1,
// custom configuration for displaying fields in the overlay/reference table
// to use the imageoverlayPalette instead of the basicoverlayPalette
'foreign_match_fields' => array(
'fieldname' => 'image',
'tablenames' => 'tx_myext_domain_model_book',
'table_local' => 'sys_file',
),
'foreign_types' => array(
'0' => array(
'showitem' => '
--palette--;;imagePalette,
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette',
),
),
), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),
),
查看从Fronded上传文件的完整工作示例。这可能对你有帮助!您的模型和TCA的“pdf”外观如何?这是签出文件类型的TCA配置(定义外来类型和表)。模型中没有其他配置。这确实是TCA问题。谢谢@欢迎光临!玩得开心:)