0

我在 TYPO3 6.2.11 中使用当前的 extension_builder 设置了一个扩展。后端中的 FAL 文件上传不起作用。

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

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

直接上传失败并显示“上传失败!需要一个带有“*”扩展名的文件!” (或我在 TCA 中指定的任何扩展名)。

参考创建工作,但保存后参考丢失。

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

在此处输入图像描述

保存后,再次清空:

在此处输入图像描述

我该如何进行这项工作?我是否必须在存储库中添加额外的代码来保存关系?或者可能缺少基本设置?

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

并且:作为一种解决方法,是否可以使用常规的“Pibase”'type' => 'group','internal_type' => 'file'字段?但是模型中的 getter 和 setter 会是什么样子呢?就像一个普通的字符串?

三氯乙酸:

    '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,但这也没有什么不同。

4

1 回答 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 提供的解决方案完全可以实现。

于 2015-03-31T09:29:43.010 回答