2017-08-09 80 views
0
'image' => array(
      'label' => 'LLL:EXT:fefiles/Resources/Private/Language/locallang_db.xlf:image', 
      'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
       'image', array(
       'appearance' => array(
        'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference' 
       ), 
       'minitems' => 0, 
       'maxitems' => 1, 
       'foreign_match_fields' => array(
        'fieldname' => 'image', 
        'tablenames' => 'tx_fechat_domain_model_smile', 
        'table_local' => 'sys_file_reference', 
       ), 
      ), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] 
      ), 
     ), 

我可以設置上傳文件夾準確地爲這個領域的文件? TYPO3版18年7月6日TYPO3設置上傳文件夾在tca

+0

https://stackoverflow.com/questions/27426426/set-upload-folder-使用時,-FAL-在-TCA#答案 - 35118970這裏就是答案:) – Xippo

回答

2

它不可能通過TCA,但你可以利用鉤。

在localconf.php文件

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['getDefaultUploadFolder']['my_ext'] = 'Vendor\\MYEXT\\Hooks\\BackendUserAuthentication->getDefaultUploadFolder'; 

在my_ext /班/鉤/ BackendUserAuthentication.php

namespace Vendor\MYEXT\Hooks; 

class BackendUserAuthentication { 
    public function getDefaultUploadFolder(Array $params, \TYPO3\CMS\Core\Authentication\BackendUserAuthentication $backendUserAuthentication) { 
     //Define table name an field for which you want to change upload path 
     if($params['table'] == 'tx_myext_domain_model_objectdetail' && ($params['field'] == 'mediafiles'||$params['field'] == 'image')) 
     { 
      $uploadFolder = new \TYPO3\CMS\Core\Resource\Folder($params['uploadFolder']->getStorage(),'/uploadfolder/','uploadfolder'); 

      return $uploadFolder; 

     } 
     return $params['uploadFolder']; 
    } 
} 
+0

很多感謝的) – Mikael