DevExtreme React - Overview

The FileUploader widget enables an end user to upload files to the server. An end user can select files in the file explorer or drag and drop files on the page's FileUploader area.

View Demo

The following code adds the FileUploader to your page. Use the accept option to restrict the file types that can be uploaded to the server. This option is like the underlying <input> element's "accept" attribute and accepts the same values described here.

A user is allowed to upload only one file at a time by default. Set the multiple option to true to allow uploading several files at once.

If you need to access the selected files at runtime, get the value of the value option using the following command. It returns an array, whose members are each an instance implementing the File interface.

JavaScript
  • var files = $("#fileUploaderContainer").dxFileUploader("option", "value");

With Angular, AngularJS, or Knockout, use a different technique. Bind the value property of the FileUploader widget to a component property (in Angular), a scope property (in AngularJS), or an observable variable (in Knockout). After that, you can access the file array within any method.

The FileUploader can operate in two different modes, each demanding a different client- and server-side configuration. See the Client-Side Settings article for more details.

See Also