class FormUploadedFile
Same name in other branches
- 9 core/modules/file/src/Upload/FormUploadedFile.php \Drupal\file\Upload\FormUploadedFile
- 10 core/modules/file/src/Upload/FormUploadedFile.php \Drupal\file\Upload\FormUploadedFile
Provides a bridge to Symfony UploadedFile.
Hierarchy
- class \Drupal\file\Upload\FormUploadedFile implements \Drupal\file\Upload\UploadedFileInterface
Expanded class hierarchy of FormUploadedFile
3 files declare their use of FormUploadedFile
- CKEditor5ImageController.php in core/
modules/ ckeditor5/ src/ Controller/ CKEditor5ImageController.php - file.module in core/
modules/ file/ file.module - Defines a "managed_file" Form API field and a "file" field for Field module.
- UploadedFileConstraintValidatorTest.php in core/
modules/ file/ tests/ src/ Kernel/ Validation/ UploadedFileConstraintValidatorTest.php
File
-
core/
modules/ file/ src/ Upload/ FormUploadedFile.php, line 13
Namespace
Drupal\file\UploadView source
class FormUploadedFile implements UploadedFileInterface {
/**
* The wrapped uploaded file.
*
* @var \Symfony\Component\HttpFoundation\File\UploadedFile
*/
protected $uploadedFile;
/**
* Creates a new FormUploadedFile.
*
* @param \Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile
* The wrapped Symfony uploaded file.
*/
public function __construct(UploadedFile $uploadedFile) {
$this->uploadedFile = $uploadedFile;
}
/**
* {@inheritdoc}
*/
public function getClientOriginalName() : string {
return $this->uploadedFile
->getClientOriginalName();
}
/**
* {@inheritdoc}
*/
public function getSize() : int {
return $this->uploadedFile
->getSize();
}
/**
* {@inheritdoc}
*/
public function getRealPath() {
return $this->uploadedFile
->getRealPath();
}
/**
* {@inheritdoc}
*/
public function getPathname() : string {
return $this->uploadedFile
->getPathname();
}
/**
* {@inheritdoc}
*/
public function getFilename() : string {
return $this->uploadedFile
->getFilename();
}
/**
* {@inheritdoc}
*/
public function validate(ValidatorInterface $validator, array $options = []) : ConstraintViolationListInterface {
$constraint = new UploadedFileConstraint($options);
return $validator->validate($this->uploadedFile, $constraint);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
FormUploadedFile::$uploadedFile | protected | property | The wrapped uploaded file. | |
FormUploadedFile::getClientOriginalName | public | function | Returns the original file name. | Overrides UploadedFileInterface::getClientOriginalName |
FormUploadedFile::getFilename | public | function | Gets the filename. | Overrides UploadedFileInterface::getFilename |
FormUploadedFile::getPathname | public | function | Gets the path to the file. | Overrides UploadedFileInterface::getPathname |
FormUploadedFile::getRealPath | public | function | Gets the absolute path to the file. | Overrides UploadedFileInterface::getRealPath |
FormUploadedFile::getSize | public | function | Gets file size. | Overrides UploadedFileInterface::getSize |
FormUploadedFile::validate | public | function | Validates the uploaded file information. | Overrides UploadedFileInterface::validate |
FormUploadedFile::__construct | public | function | Creates a new FormUploadedFile. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.