class UploadedFileConstraint

Same name and namespace in other branches
  1. 10 core/modules/file/src/Validation/Constraint/UploadedFileConstraint.php \Drupal\file\Validation\Constraint\UploadedFileConstraint
  2. 11.x core/modules/file/src/Validation/Constraint/UploadedFileConstraint.php \Drupal\file\Validation\Constraint\UploadedFileConstraint

A constraint for UploadedFile objects.

Hierarchy

  • class \Drupal\file\Validation\Constraint\UploadedFileConstraint extends \Symfony\Component\Validator\Constraint

Expanded class hierarchy of UploadedFileConstraint

1 file declares its use of UploadedFileConstraint
FormUploadedFile.php in core/modules/file/src/Upload/FormUploadedFile.php

File

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

Namespace

Drupal\file\Validation\Constraint
View source
class UploadedFileConstraint extends Constraint {
  
  /**
   * The upload max size. Defaults to checking the environment.
   */
  public ?int $maxSize = NULL;
  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;
  }

}

Members

Title Sort descending Modifiers Object type Summary
UploadedFileConstraint::$maxSize public property The upload max size. Defaults to checking the environment.
UploadedFileConstraint::__construct public function #[HasNamedArguments]

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