postUpload

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.

Parameters

  1. array $files

    List of files that have been uploaded. The file paths are relative to the Contao root directory.

Example

// src/EventListener/PostUploadListener.php
namespace App\EventListener;

use Contao\CoreBundle\ServiceAnnotation\Hook;

/**
 * @Hook("postUpload")
 */
class PostUploadListener
{
    public function __invoke(array $files): void
    {
        // Do something …
    }
}

References