function FileUploadSanitizeNameEvent::__construct
Same name in other branches
- 9 core/lib/Drupal/Core/File/Event/FileUploadSanitizeNameEvent.php \Drupal\Core\File\Event\FileUploadSanitizeNameEvent::__construct()
- 11.x core/lib/Drupal/Core/File/Event/FileUploadSanitizeNameEvent.php \Drupal\Core\File\Event\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\EventCode
public function __construct(string $filename, string $allowed_extensions) {
$this->setFilename($filename);
if ($allowed_extensions !== '') {
$this->allowedExtensions = array_unique(explode(' ', trim(strtolower($allowed_extensions))));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.