AfterDefaultUploadFolderWasResolvedEvent

New in version 12.3

The event can be used as an improved alternative for the deprecated $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['getDefaultUploadFolder'] hook, serving the same purpose.

The PSR-14 event \TYPO3\CMS\Core\Resource\Event\AfterDefaultUploadFolderWasResolvedEvent allows to modify the default upload folder after it has been resolved for the current page or user.

Example

EXT:my_extension/Classes/Resource/EventListener/MyEventListener.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Resource\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Resource\Event\AfterDefaultUploadFolderWasResolvedEvent;

#[AsEventListener(
    identifier: 'my-extension/after-default-upload-folder-was-resolved',
)]
final readonly class MyEventListener
{
    public function __invoke(AfterDefaultUploadFolderWasResolvedEvent $event): void
    {
        $event->setUploadFolder($event->getUploadFolder()->getStorage()->getFolder('/'));
    }
}
Copied!

New in version 13.0

The PHP attribute \TYPO3\CMS\Core\Attribute\AsEventListener has been introduced to tag a PHP class as an event listener. Alternatively, or if you need to be compatible with older TYPO3 versions, you can also register an event listener via the Configuration/Services.yaml file. Switch to an older version of this page for an example or have a look at the section Implementing an event listener in your extension.

API

class AfterDefaultUploadFolderWasResolvedEvent
Fully qualified name
\TYPO3\CMS\Core\Resource\Event\AfterDefaultUploadFolderWasResolvedEvent

Event that is fired after the default upload folder for a user was checked

getUploadFolder ( )
Returns
?TYPO3CMSCoreResourceFolderInterface
setUploadFolder ( TYPO3\CMS\Core\Resource\FolderInterface $uploadFolder)
param $uploadFolder

the uploadFolder

getPid ( )
Returns
?int
getTable ( )
Returns
?string
getFieldName ( )
Returns
?string