2015-03-31 130 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