I see that the Github Issue says this isn't currently supported, but it seems relatively uncomplicated to fork this project and bend it to your needs. All the fnError =
's you'll find in a Cmd + F
search inside fileinput.js
are where you need to look.
Take for instance here: https://github.com/kartik-v/bootstrap-fileinput/blob/d5ed3ee989edbd5d67b8cf4bdadc9f3c18609965/js/fileinput.js#L1897
This is for the batch file-upload that currently looks like this:
fnError = function (jqXHR, textStatus, errorThrown) {
var outData = self._getOutData(jqXHR), errMsg = self._parseError(jqXHR, errorThrown);
self._showUploadError(errMsg, outData, 'filebatchuploaderror');
self.uploadFileCount = total - 1;
if (!self.showPreview) {
return;
}
self._getThumbs().each(function () {
var $thumb = $(this), key = $thumb.attr('data-fileindex');
$thumb.removeClass('file-uploading');
if (self.filestack[key] !== undefined) {
self._setPreviewError($thumb);
}
});
self._getThumbs().removeClass('file-uploading');
self._getThumbs(' .kv-file-upload').removeAttr('disabled');
self._getThumbs(' .kv-file-delete').removeAttr('disabled');
};
I'd try modifying this to:
fnError = function (jqXHR, textStatus, errorThrown) {
if (!myError.equals(textStatus)) { // A service-like impl. injection would be sexier
var outData = self._getOutData(jqXHR), errMsg = self._parseError(jqXHR, errorThrown);
self._showUploadError(errMsg, outData, 'filebatchuploaderror');
self.uploadFileCount = total - 1;
if (!self.showPreview) {
return;
}
self._getThumbs().each(function () {
var $thumb = $(this), key = $thumb.attr('data-fileindex');
$thumb.removeClass('file-uploading');
if (self.filestack[key] !== undefined) {
self._setPreviewError($thumb);
}
});
self._getThumbs().removeClass('file-uploading');
self._getThumbs(' .kv-file-upload').removeAttr('disabled');
self._getThumbs(' .kv-file-delete').removeAttr('disabled');
} else {
self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, function() {
// TODO: Second time failure - handle recursively or differently? :-)
);
}
};
Hope this helps!