function UploadedFileConstraint::__construct

Same name and namespace in other branches
  1. 11.x core/modules/file/src/Validation/Constraint/UploadedFileConstraint.php \Drupal\file\Validation\Constraint\UploadedFileConstraint::__construct()

Constructs an UploadedFileConstraint object.

Parameters

int|null $maxSize: The upload max size. Defaults to checking the environment.

string $uploadIniSizeErrorMessage: Error message if file exceeds maximum allowed uploaded size set by the PHP environment.

string $uploadFormSizeErrorMessage: Error message if file exceeds maximum allowed uploaded size set for the form.

string $uploadPartialErrorMessage: Error message if the upload only partially completed.

string $uploadNoFileErrorMessage: Error message if the uploaded file could not be found.

string $uploadErrorMessage: Generic error message for upload failure.

array|null $groups: An array of validation groups.

mixed|null $payload: Domain-specific data attached to a constraint.

File

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

Class

UploadedFileConstraint
A constraint for UploadedFile objects.

Namespace

Drupal\file\Validation\Constraint

Code

public function __construct(public ?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(groups: $groups, payload: $payload);
}

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