The postUpload
hook is triggered after a user has uploaded one or more file in
the back end. It passes an array of filenames as argument and does not expect
a return value.
This hook can also be implemented as an anonymous function.
array $files
List of files that have been uploaded. The file paths are relative to the Contao root directory.
// src/EventListener/PostUploadListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
#[AsHook('postUpload')]
class PostUploadListener
{
public function __invoke(array $files): void
{
// Do something …
}
}