Enable / Disable State
Programmatically enable or disable the uploader UI.
Enabled
(function() {
var uploader = new MultipleUpload('#demo', {
uploadUrl: '/api/upload',
multiple: true
});
document.getElementById('toggle-btn').addEventListener('click', function() {
if (uploader.isEnabled()) {
uploader.disable();
document.getElementById('state-label').textContent = 'Disabled';
} else {
uploader.enable();
document.getElementById('state-label').textContent = 'Enabled';
}
});
})();
Turning the control off and on
disable() and enable() are methods on the instance rather than options, because this is a state that changes while the page is open. Disabling blocks new selections and drops; enabling restores them.
What it is usually wired to
A form that is mid-submit, a quota that has been reached, a plan limit, or a step in a wizard the user has not got to yet. The point is that the reason is visible: pair the call with a message saying why, because a control that simply stops responding reads as a bug.