2015-03-31 127 views
0

我已经在TYPO3 6.2.11中设置了当前extension_builder的扩展。 FAL在后端上传文件不起作用。TYPO3 Extbase扩展:后端FAL上传失败

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

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

直接上传失败,显示“上传失败!预计会有扩展名为*的文件!” (或者我在TCA中指定的任何扩展)。

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

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

enter image description here

并保存后,再空:

enter image description here

如何使这项工作?我是否需要为回购保存关系添加额外的代码?或者可能会丢失一个基本设置?

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

并且:作为解决方法,是否可以使用常规“Pibase”'type' => 'group','internal_type' => 'file'字段?但是模型中的吸气剂和吸附剂又会如何呢?就像一个普通的字符串?

TCA:由extension_builder创建

'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), 
     '*' 
    ), 
    ), 

型号:

/** 
* 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>,而不是​​,但这并不有所作为无论是。

回答

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提供的解决方案。

+0

我改变了,但它不会帮助(卸载扩展,清除所有缓存等)。奇怪。这只是关于上传 – Urs 2015-03-31 12:05:44

+0

也许一个愚蠢的问题,但只是为了安全起见:一个叫做apprenticeship_document的字段存在吗? – lorenz 2015-03-31 14:23:35

+0

我编辑了我的答案。 – lorenz 2015-03-31 14:29:20