class FileNameLengthConstraint
File name length constraint.
Attributes
#[Constraint(id: 'FileNameLength', label: new TranslatableMarkup('File Name Length', [], [
'context' => 'Validation',
]), type: 'file')]
  Hierarchy
- class \Drupal\file\Plugin\Validation\Constraint\FileNameLengthConstraint extends \Symfony\Component\Validator\Constraint
 
Expanded class hierarchy of FileNameLengthConstraint
File
- 
              core/
modules/ file/ src/ Plugin/ Validation/ Constraint/ FileNameLengthConstraint.php, line 12  
Namespace
Drupal\file\Plugin\Validation\ConstraintView source
class FileNameLengthConstraint extends SymfonyConstraint {
  
  /**
   * The maximum file name length.
   *
   * @var int
   */
  public int $maxLength = 240;
  
  /**
   * The message when file name is empty.
   *
   * @var string
   */
  public string $messageEmpty = "The file's name is empty. Enter a name for the file.";
  
  /**
   * The message when file name is too long.
   *
   * @var string
   */
  public string $messageTooLong = "The file's name exceeds the %maxLength characters limit. Rename the file and try again.";
}
Members
| Title Sort descending | Modifiers | Object type | Summary | 
|---|---|---|---|
| FileNameLengthConstraint::$maxLength | public | property | The maximum file name length. | 
| FileNameLengthConstraint::$messageEmpty | public | property | The message when file name is empty. | 
| FileNameLengthConstraint::$messageTooLong | public | property | The message when file name is too long. | 
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.