Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FileUploadSanitizeNameEvent.php

function FileUploadSanitizeNameEvent::__construct

Constructs a file upload sanitize name event object.

Parameters

string $filename: The full filename (with extension, but not directory) being uploaded.

string $allowed_extensions: A list of allowed extensions. If empty all extensions are allowed.

File

core/lib/Drupal/Core/File/Event/FileUploadSanitizeNameEvent.php, line 45

Class

FileUploadSanitizeNameEvent
An event during file upload that lets subscribers sanitize the filename.

Namespace

Drupal\Core\File\Event

Code

public function __construct(string $filename, string $allowed_extensions) {
    $this->setFilename($filename);
    if ($allowed_extensions !== '') {
        $this->allowedExtensions = array_unique(explode(' ', trim(strtolower($allowed_extensions))));
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal