function UploadedFileConstraint::__construct

Attributes

#[HasNamedArguments]

File

core/modules/file/src/Validation/Constraint/UploadedFileConstraint.php, line 20

Class

UploadedFileConstraint
A constraint for UploadedFile objects.

Namespace

Drupal\file\Validation\Constraint

Code

public function __construct(mixed $options = NULL, ?int $maxSize = NULL, public string $uploadIniSizeErrorMessage = 'The file %file could not be saved because it exceeds %maxsize, the maximum allowed size for uploads.', public string $uploadFormSizeErrorMessage = 'The file %file could not be saved because it exceeds %maxsize, the maximum allowed size for uploads.', public string $uploadPartialErrorMessage = 'The file %file could not be saved because the upload did not complete.', public string $uploadNoFileErrorMessage = 'The file %file could not be saved because the upload did not complete.', public string $uploadErrorMessage = 'The file %file could not be saved. An unknown error has occurred.', ?array $groups = NULL, mixed $payload = NULL) {
  parent::__construct($options, $groups, $payload);
  $this->maxSize = $maxSize ?? $this->maxSize;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.