The Upload widget allows for a user-friendly experience for choosing files to upload.
This example demonstrates initializing an Upload widget with no additional options specified.
<form method="post" data-bind="kendoUpload: {}">
<div>
<input name="files[]" type="file" />
</div>
</form>
var ViewModel = function() {};
ko.applyBindings(new ViewModel());
This example demonstrates passing additional options in the data-bind attribute.
<input type="checkbox" data-bind="checked: enabled" /> Enabled
<hr/>
<form method="post" data-bind="kendoUpload: { enabled: enabled }">
<div>
<input class="btn" name="files[]" type="file" />
</div>
</form>
var ViewModel = function() {
this.enabled = ko.observable(true);
};
ko.applyBindings(new ViewModel());
This example demonstrates setting global options in ko.bindingHandlers.kendoUpload.options. This helps to simplify the markup for settings that can be used as a default for all instances of this widget.
<form method="post" data-bind="kendoUpload: {}">
<div>
<input name="files[]" type="file" />
</div>
</form>
var ViewModel = function() {};
ko.bindingHandlers.kendoUpload.options.multiple = false;
ko.applyBindings(new ViewModel());