I am trying to restrict the file type (only mp3 files) when I open a dialog with uploadcare.
uploadcare.loadFileGroup(soundGroupID)
.done(function (fileGroup) {
uploadcare.openDialog(fileGroup.files(), {
multiple: true,
multipleMin: 0,
fileTypes="mp3"
}).done(
function (file) {
file.promise().done(
function (fileInfo) {
//TODO Something
});
});
})
.fail(function () {
// Something went wrong.
});
Is there any way to push a validator? Is there any way to access the widget? As you can see, I am opening a dialog so I can not access the widget anywhere.
Unfortunately there is no validators for dialogs in current API, only for widgets. But you can create fake widget and use
.openDialog()
method on it.Alternatively, you can pass list of validators in private
__validators
option, but this is internal API and can be changed in future versions.