UploadedFileAccessTrait
Convenience accessors returning flat lists of UploadedFileInterface instances, hiding PSR-7’s nested-array upload structure from callers.
Synopsis
Section titled “Synopsis”trait UploadedFileAccessTrait
| Source | Request/UploadedFileAccessTrait.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
getFile(string $name, mixed $default = null): mixed | Convenience alias for getUploadedFileArray — returns PSR-7 UploadedFileInterface array. |
getUploadedFile(string $name): ?UploadedFileInterface | Return the first uploaded file for a given field name or null if none exist. |
getUploadedFileArray(string $name): array<UploadedFileInterface> |
getFile()
Section titled “getFile()”public function getFile(string $name, mixed $default = null): mixed
Convenience alias for getUploadedFileArray — returns PSR-7 UploadedFileInterface array.
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$default | mixed |
Returns mixed
getUploadedFile()
Section titled “getUploadedFile()”public function getUploadedFile(string $name): ?UploadedFileInterface
Return the first uploaded file for a given field name or null if none exist.
| Parameter | Type | Description |
|---|---|---|
$name | string |
Returns ?UploadedFileInterface
getUploadedFileArray()
Section titled “getUploadedFileArray()”public function getUploadedFileArray(string $name): array<UploadedFileInterface>
| Parameter | Type | Description |
|---|---|---|
$name | string |
Returns array``<UploadedFileInterface>