InputFile
API reference › HTML › Form › InputFile
Renders the HTML <input type="file"> element.
See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/file.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$attributes protected | mixed[] | HTML attributes array used by the implementing class. Default: []. | UIAwesome\ |
$prefix protected | string | Prefix content string assigned to the element. Default: ''. | UIAwesome\ |
$prefixAttributes protected | array | HTML attributes array for the prefix element. Default: []. | UIAwesome\ |
$prefixTag protected | false|UnitEnum | Tag name for the prefix element, or false to disable. Default: false. | UIAwesome\ |
$suffix protected | string | Suffix content string assigned to the element. Default: ''. | UIAwesome\ |
$suffixAttributes protected | array | HTML attributes array for the suffix element. Default: []. | UIAwesome\ |
$suffixTag protected | false|UnitEnum | Tag name for the suffix element, or false to disable. Default: false. | UIAwesome\ |
$template protected | string | Template string used for constructing the HTML tag. Default: ''. | UIAwesome\ |
Methods
Section titled “Methods”Method details
Section titled “Method details”accept()
Section titled “accept() ”public function accept(string|Stringable|UnitEnum|null $value): staticSets the accept attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|Stringable|UnitEnum| | Accept value, or null to remove the attribute. |
Returns
static: New instance with the updated accept attribute.
capture()
Section titled “capture() ”public function capture(string|Stringable|UnitEnum|null $value): staticSets the capture attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|Stringable|UnitEnum| | Capture value, or null to remove the attribute. |
Returns
static: New instance with the updated capture attribute.
getAttributes()
Section titled “getAttributes() ”public function getAttributes(): mixed[]Returns the array of HTML attributes for the element.
Returns
mixed[]: Attributes array using array notation for named multiple-file inputs and omitting the unsupported value attribute.
multiple()
Section titled “multiple() ”public function multiple(bool|null $value): staticSets the multiple attribute.
An absent or empty name remains omitted from rendered markup.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool| | Multiple state. Use true to allow multiple values, false to disallow, or null to remove the attribute. |
Returns
static: New instance with the updated multiple attribute.
required()
Section titled “required() ”public function required(bool|null $value): staticSets the required attribute.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | bool| | Required state. Use true to require a value, false to make it optional, or null to remove the attribute. |
Returns
static: New instance with the updated required attribute.
getTag()
Section titled “getTag() ”protected function getTag(): UIAwesome\Html\Interop\VoidsReturns the tag enumeration for the <input> element.
Returns
Voids: Tag enumeration instance for <input>.
loadDefault()
Section titled “loadDefault() ”protected function loadDefault(): array<string, mixed>Returns the default configuration for the input element.
Returns
array<string, mixed>: Default configuration for the input element, including the default type attribute set to file.
run()
Section titled “run() ”protected function run(): stringRenders the <input> element with its attributes.
Returns
string: Rendered HTML for the <input> element.