首页 文章

TYPO3 Extbase扩展:后端FAL上传失败

提问于
浏览
0

我在TYPO3 6.2.11中设置了当前extension_builder的扩展 . 后端的FAL文件上载无效 .

extension_builder说在extbase中根本没有实现文件上传,但据我所知(cf https://github.com/helhum/upload_example),这是关于FE上传的 . 正确?

我只需要完全定期的BE文件上传 - 通过“创建新关系”或“选择并上传文件”进行选择 .

直接上传失败,“上传失败!预计会有一个带*”扩展名的文件!“ (或我在TCA中指定的任何扩展名) .

参考创建有效,但保存后参考丢失 .

此屏幕截图显示了保存前的两次尝试 .

enter image description here

保存后,再次清空:

enter image description here

How do I make this work? 我是否必须在repo中添加额外的代码以保存关系?或者可能缺少基本设置?

对于tt_content,FAL关系和上传工作正常 .

并且:作为一种解决方法,是否可以使用常规"Pibase" 'type' => 'group','internal_type' => 'file' 字段?但是模型中的吸气剂和制定者怎么样?就像一个普通的字符串?

TCA:

'apprenticeship_document' => array(
      'exclude' => 1,
      'label' => 'LLL:EXT:stellen/Resources/Private/Language/locallang_db.xlf:tx_stellen_domain_model_institution.apprenticeship_document',
      'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
        'apprenticeshipDocument',
        array('maxitems' => 1),
        '*'
      ),
    ),

由extension_builder创建的模型:

/**
 * apprenticeshipDocument
 *
 * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
 */
protected $apprenticeshipDocument = NULL;

/**
 * Returns the apprenticeshipDocument
 *
 * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $apprenticeshipDocument
 */
public function getApprenticeshipDocument() {
    return $this->apprenticeshipDocument;
}

/**
 * Sets the apprenticeshipDocument
 *
 * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $apprenticeshipDocument
 * @return void
 */

public function setApprenticeshipDocument(\TYPO3\CMS\Extbase\Domain\Model\FileReference $apprenticeshipDocument) {
    $this->apprenticeshipDocument = $apprenticeshipDocument;
}

我也尝试使用 \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> 而不是 \TYPO3\CMS\Extbase\Domain\Model\FileReference $apprenticeshipDocument ,但这也没有什么区别 .

1 回答

  • 1

    您的TCA定义有错误, getFileFieldTCAConfig 的第一个参数应该是较低的下划线,而不是lowerCamelCase:

    'apprenticeship_document' => array(
      'exclude' => 1,
      'label' => 'LLL:EXT:stellen/Resources/Private/Language/locallang_db.xlf:tx_stellen_domain_model_institution.apprenticeship_document',
      'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
        'apprenticeship_document',
        array('maxitems' => 1),
        'pdf,doc,docx'
      ),
    ),
    

    除此之外,"*"不是有效的文件扩展名 . 您需要定义以逗号分隔的文件扩展名列表(例如 'doc,docx,pdf' ) . 从阅读文档,文件扩展名没有通配符 .

    FE中的文件上传未在Extension Builder中实现,但完全可以使用Helmut Hummel提供的解决方案 .

相关问题