FileUploader component
The File Uploader component is an adapter for the jQuery-File-Upload plugin used in Magento. This component integrates file upload functionality with UI components.
Options
Title
Description
Type
Default Value
allowedExtensionsList of allowed file extensions. For example,
'jpg jpeg gif png svg'. If set to "false" - then no extension is allowed, "true" - any extension is allowed.Boolean/String
falsecomponentThe path to the component's JS constructor in terms of RequireJS.
String
'Magento_Ui/js/form/element/file-uploader'dropZoneCSS selector of a drop zone element.
String
[data-role=drop-zone]isMultipleFilesDefines whether multiple files can be uploaded.
Boolean
falsemaxFileSizeDefines the maximum allowed file size in bytes.
Boolean/Number
falseplaceholderTypeDefines the preview type. (When set to
document, the file information is displayed.)document | image | videodocumentpreviewTmplPath to the file's preview
.html templateString
ui/form/element/uploader/previewuploaderConfigConfiguration passed to jquery-file-upload plugin.
Object
{dataType: 'json', sequentialUploads: true, formData: {'form_key': window.FORM_KEY}}Examples
Integration
Here is an example of how File Uploader component integrates with Form component:
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
<fieldset name="foo">
...
<settings>
<label translate="true">Foo</label>
<collapsible>true</collapsible>
<opened>true</opened>
</settings>
<field name="bar" formElement="fileUploader">
<settings>
<label translate="true">Sound Check</label>
</settings>
<formElements>
<fileUploader>
<settings>
<uploaderConfig>
<param xsi:type="string" name="url">path/to/controller</param>
</uploaderConfig>
</settings>
</fileUploader>
</formElements>
</field>
</fieldset>
</form>
Result
Source files
Extends abstract: