[TYPO3-dev] Re: Howto define processedFiles folder for each feuser within extension
Andreas Haubold
info at andreas-haubold.de
Mon Nov 7 21:35:11 CET 2016
Hello Florian,
thanks a lot for your reply. Sorry that I didn't explained clearly what my intention was. The upload worked quite well and I did it in the way you explained. The problem was the download where the ext:fal_securedownload realy helped out. The only problem left is to redirect the user correctly if not authenticated.
For the upload I created a type converter method and a small StorageUtility. The type converter is called in the intitializeCreateAction of the controller.
/**
* Set type converter configuration
*
* @param string $argumentName
* @return void
*/
protected function setTypeConverterConfigurationForImageUpload($argumentName)
{
$uploadConfiguration = array(
UploadedFileReferenceConverter::CONFIGURATION_ALLOWED_FILE_EXTENSIONS => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
UploadedFileReferenceConverter::CONFIGURATION_UPLOAD_FOLDER => $this->storageUtility->getUploadFolderOfUser(),
);
[..]
}
In the StorageUtility the upload folder of the account the user belongs to is resolved.
/**
* Returns the upload folder as string ([storageUid]:/[accountUid], e.g. '2:/16')
*
* @return string
*/
public static function getUploadFolderOfUser()
{
$settings = ConfigurationService::getPluginSettings();
return $settings['falStorageUid'] . ':/' . self::getFolderIdentifier() . '/';
}
/**
* Returns the folder identifier which belongs to a user (the accountUid)
*
* @return int
*/
public static function getFolderIdentifier()
{
return $GLOBALS['TSFE']->fe_user->user['tx_myextension_domain_model_account'];
}
Best
Andreas
More information about the TYPO3-dev
mailing list