File component
The File component implements the HTML <input type="file"> form field.
Options
Option
Description
Type
Default
componentThe path to the component’s JS constructor in terms of RequireJS.
String
Magento_Ui/js/form/element/medialabelLabel to be displayed in the field.
String
''links.valueLinks the component's
value property with provider using the declared in the dataScope property of the parent component.Boolean
''disabledInitial component's state. When set to
true, users cannot take action on the element.Boolean
falsevisibleInitial component's visibility. When set to
false, the display: none CSS style is added to the component's DOM block.Boolean
trueSource files
Extends Abstract:
app/code/Magento/Ui/view/base/web/js/form/element/media.jsapp/code/Magento/Ui/view/base/web/templates/form/element/media.htmlapp/code/Magento/Ui/view/base/web/templates/form/field.html
Examples
Integration
This is an example of how the File component integrates with the Form component:
<form>
...
<fieldset>
...
<file name="file_example">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">File Field</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="path/to/controller"/>
</item>
</item>
</argument>
</file>
</fieldset>
</form>
Result