UI Widgets FileUploader

A widget used to select and upload a file or multiple files.

Included in: dx.phonejs.js, dx.webappjs.js, dx.all.js
FileUploader interactive configuration
Copy code
$("#fileuploader").dxFileUploader({
});

The dxFileUploader widget is based on an input element with the type attribute set to "file". Values of widget options are passed to appropriate attributes of the underlying input element.

You can create a widget using one of the following approaches.

  • jQuery
    Use the dxFileUploader jQuery plug-in.

    HTML
    <div id="fileUploader"></div>
    JavaScript
    $("#fileUploader").dxFileUploader({
        buttonText: 'Select file',
        labelText: 'Drop file here',
        multiple: true,
        accept: 'image/*'
    });
  • Knockout
    Add a div element and apply the dxFileUploader binding to this element.

    HTML
    <div data-bind="dxFileUploader: {
        buttonText: 'Select file',
        labelText: 'Drop file here',
        multiple: true,
        accept: 'image/*'
    }"></div>
  • Angular
    Add a div element and apply the dx-file-uploader directive to this element.

    HTML
    <div dx-file-uploader="{
        buttonText: 'Select file',
        labelText: 'Drop file here',
        multiple: true,
        accept: 'image/*'
    }"></div>

Note that DevExtreme widgets require you to link the jQuery and Globalize libraries to your application. If you use the Knockout or Angular approach, the Knockout or Angular library is also required. For detailed information on linking these libraries to your project, refer to the Installation article.

You can find detailed information on the principles of working with the widget in the dxFileUploader section of the Editor Widgets article.

View Demo

Watch Video

Show Example:
AngularJS
Knockout
jQuery
<div ng-controller="demoController">
    <div class="uploader" dx-file-uploader="{
        multiple: true,
        uploadMode: 'useButtons',
        uploadUrl: '/Content/Services/upload.aspx'
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
body {
  text-align: center;
}
.uploader {
  margin-top: 25px;
}
<div class="uploader" data-bind="dxFileUploader: {
    multiple: true,
    uploadMode: 'useButtons',
    uploadUrl: '/Content/Services/upload.aspx'
}"></div>
var myViewModel = {}
ko.applyBindings(myViewModel);
body {
  text-align: center;
}
.uploader {
  margin-top: 25px;
}
<div class="uploader" id="myFileUploader"></div>
$("#myFileUploader").dxFileUploader({
    multiple: true,
    uploadMode: 'useButtons',
    uploadUrl: '/Content/Services/upload.aspx'
});
body {
  text-align: center;
}
.uploader {
  margin-top: 25px;
}

Configuration

An object defining configuration options for the dxFileUploader widget.

Methods

This section describes the members used to manipulate the widget.

Events

This section describes events fired by this widget.