public function FileUploadSanitizeNameEvent::__construct in Drupal 9
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\EventCode
public function __construct(string $filename, string $allowed_extensions) {
$this
->setFilename($filename);
if ($allowed_extensions !== '') {
$this->allowedExtensions = array_unique(explode(' ', trim(strtolower($allowed_extensions))));
}
}