diff --git a/js/fileinput.js b/js/fileinput.js
index fe7490f1..3b709695 100755
--- a/js/fileinput.js
+++ b/js/fileinput.js
@@ -1584,12 +1584,12 @@
var pct = 0, total = event.total, position = event.loaded || event.position;
/** @namespace event.lengthComputable */
if (event.lengthComputable) {
- pct = Math.ceil(position / total * 100);
+ pct = Math.floor(position / total * 100);
}
if (previewId) {
self._setAsyncUploadStatus(previewId, pct, fileCount);
} else {
- self._setProgress(Math.ceil(pct));
+ self._setProgress(pct);
}
}, false);
}
@@ -1754,7 +1754,7 @@
self.uploadCount = 0;
self.uploadStatus = {};
self.uploadLog = [];
- self._setProgress(100);
+ self._setProgress(101);
}, 100);
};
fnBefore = function (jqXHR) {
@@ -1809,6 +1809,7 @@
$btnUpload.removeAttr('disabled');
$btnDelete.removeAttr('disabled');
$thumb.removeClass('file-uploading');
+ self._setProgress(101, $('#' + previewId).find('.file-thumb-progress'));
}
if (!allFiles) {
self.unlock(false);
@@ -1916,7 +1917,7 @@
}
};
fnComplete = function () {
- self._setProgress(100);
+ self._setProgress(101);
self.unlock();
self._initSuccessThumbs();
self._clearFileInput();
@@ -1976,7 +1977,7 @@
}
};
fnComplete = function () {
- self._setProgress(100);
+ self._setProgress(101);
self.unlock();
self._clearFileInput();
self._raise('filebatchuploadcomplete', [self.filestack, self._getExtraData()]);
@@ -2337,16 +2338,17 @@
},
_setProgressCancelled: function () {
var self = this;
- self._setProgress(100, self.$progress, self.msgCancelled);
+ self._setProgress(101, self.$progress, self.msgCancelled);
},
_setProgress: function (p, $el, error) {
var self = this, pct = Math.min(p, 100), template = pct < 100 ? self.progressTemplate :
- (error ? self.progressErrorTemplate : self.progressCompleteTemplate),
+ (error ? self.progressErrorTemplate : (p <= 100 ? self.progressTemplate : self.progressCompleteTemplate)),
pctLimit = self.progressUploadThreshold;
$el = $el || self.$progress;
if (!isEmpty(template)) {
- if (pctLimit && pct > pctLimit) {
- $el.html(template.replace('{percent}%', self.msgUploadThreshold).replace(/\{percent}/g, pctLimit));
+ if (pctLimit && pct > pctLimit && p <= 100) {
+ var out = template.replace('{percent}', pctLimit).replace('{percent}', pctLimit).replace('{percent}%', self.msgUploadThreshold);
+ $el.html(out);
} else {
$el.html(template.replace(/\{percent}/g, pct));
}
@@ -2378,7 +2380,7 @@
$.each(self.uploadStatus, function (key, value) {
sum += value;
});
- self._setProgress(Math.ceil(sum / total));
+ self._setProgress(Math.floor(sum / total));
},
_validateMinCount: function () {
@@ -2813,7 +2815,7 @@
data.abortData = self.ajaxAborted.data || {};
data.abortMessage = self.ajaxAborted.message;
self.cancel();
- self._setProgress(100, self.$progress, self.msgCancelled);
+ self._setProgress(101, self.$progress, self.msgCancelled);
self._showUploadError(self.ajaxAborted.message, data, 'filecustomerror');
return true;
}
@@ -3194,7 +3196,7 @@
progressClass: "progress-bar progress-bar-success progress-bar-striped active",
progressCompleteClass: "progress-bar progress-bar-success",
progressErrorClass: "progress-bar progress-bar-danger",
- progressUploadThreshold: 95,
+ progressUploadThreshold: 99,
previewFileType: 'image',
elCaptionContainer: null,
elCaptionText: null,
diff --git a/js/fileinput.min.js b/js/fileinput.min.js
index 0bdcae84..39123fc3 100755
--- a/js/fileinput.min.js
+++ b/js/fileinput.min.js
@@ -7,6 +7,7 @@
*
* Licensed under the BSD 3-Clause
* https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md
- */!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):e(window.jQuery)}(function(e){"use strict";e.fn.fileinputLocales={},e.fn.fileinputThemes={};var t,i,a,n,r,l,o,s,d,c,p,u,f,m,g,v,h,w,b,_,C,x,y,T,F,k,E,$,S,I,P,D,z,A,U,j,L,Z,B,O,R,M,N,H,q,W,V,K,G,X,Y,J,Q,ee,te,ie,ae,ne,re,le,oe,se,de,ce,pe,ue,fe,me;t=".fileinput",i="kvFileinputModal",a='style="width:{width};height:{height};"',n='\n\n\n\n\n\n',r='
\n{previewFileIcon}\n
',l=window.URL||window.webkitURL,o=function(e,t,i){return void 0!==e&&(i?e===t:e.match(t))},s=function(e){if("Microsoft Internet Explorer"!==navigator.appName)return!1;if(10===e)return new RegExp("msie\\s"+e,"i").test(navigator.userAgent);var t,i=document.createElement("div");return i.innerHTML="",t=i.getElementsByTagName("i").length,document.body.appendChild(i),i.parentNode.removeChild(i),t},d=function(e,i,a,n){var r=n?i:i.split(" ").join(t+" ")+t;e.off(r).on(r,a)},c={data:{},init:function(e){var t=e.initialPreview,i=e.id;t.length>0&&!ne(t)&&(t=t.split(e.initialPreviewDelimiter)),c.data[i]={content:t,config:e.initialPreviewConfig,tags:e.initialPreviewThumbTags,delimiter:e.initialPreviewDelimiter,previewFileType:e.initialPreviewFileType,previewAsData:e.initialPreviewAsData,template:e.previewGenericTemplate,showZoom:e.fileActionSettings.showZoom,showDrag:e.fileActionSettings.showDrag,getSize:function(t){return e._getSize(t)},parseTemplate:function(t,i,a,n,r,l,o){var s=" file-preview-initial";return e._generatePreviewTemplate(t,i,a,n,r,!1,null,s,l,o)},msg:function(t){return e._getMsgSelected(t)},initId:e.previewInitId,footer:e._getLayoutTemplate("footer").replace(/\{progress}/g,e._renderThumbProgress()),isDelete:e.initialPreviewShowDelete,caption:e.initialCaption,actions:function(t,i,a,n,r,l,o){return e._renderFileActions(t,i,a,n,r,l,o,!0)}}},fetch:function(e){return c.data[e].content.filter(function(e){return null!==e})},count:function(e,t){return c.data[e]&&c.data[e].content?t?c.data[e].content.length:c.fetch(e).length:0},get:function(t,i,a){var n,r,l,o,s,d,p="init_"+i,u=c.data[t],f=u.config[i],m=u.content[i],g=u.initId+"-"+p,v=" file-preview-initial",h=re("previewAsData",f,u.previewAsData);return a=void 0===a?!0:a,m?(f&&f.frameClass&&(v+=" "+f.frameClass),h?(l=u.previewAsData?re("type",f,u.previewFileType||"generic"):"generic",o=re("caption",f),s=c.footer(t,i,a,f&&f.size||null),d=re("filetype",f,l),n=u.parseTemplate(l,m,o,d,g,s,p,null)):n=u.template.replace(/\{previewId}/g,g).replace(/\{frameClass}/g,v).replace(/\{fileindex}/g,p).replace(/\{content}/g,u.content[i]).replace(/\{template}/g,re("type",f,u.previewFileType)).replace(/\{footer}/g,c.footer(t,i,a,f&&f.size||null)),u.tags.length&&u.tags[i]&&(n=se(n,u.tags[i])),ae(f)||ae(f.frameAttr)||(r=e(document.createElement("div")).html(n),r.find(".file-preview-initial").attr(f.frameAttr),n=r.html(),r.remove()),n):""},add:function(t,i,a,n,r){var l,o=e.extend(!0,{},c.data[t]);return ne(i)||(i=i.split(o.delimiter)),r?(l=o.content.push(i)-1,o.config[l]=a,o.tags[l]=n):(l=i.length-1,o.content=i,o.config=a,o.tags=n),c.data[t]=o,l},set:function(t,i,a,n,r){var l,o,s=e.extend(!0,{},c.data[t]);if(i&&i.length&&(ne(i)||(i=i.split(s.delimiter)),o=i.filter(function(e){return null!==e}),o.length)){if(void 0===s.content&&(s.content=[]),void 0===s.config&&(s.config=[]),void 0===s.tags&&(s.tags=[]),r){for(l=0;lr;r++)i+=c.get(e,r);return t=a.msg(c.count(e)),{content:''+i+"
",caption:t}},footer:function(e,t,i,a){var n=c.data[e];if(i=void 0===i?!0:i,0===n.config.length||ae(n.config[t]))return"";var r=n.config[t],l=re("caption",r),o=re("width",r,"auto"),s=re("url",r,!1),d=re("key",r,null),p=re("showDelete",r,!0),u=re("showZoom",r,n.showZoom),f=re("showDrag",r,n.showDrag),m=s===!1&&i,g=n.isDelete?n.actions(!1,p,u,f,m,s,d):"",v=n.footer.replace(/\{actions}/g,g);return v.replace(/\{caption}/g,l).replace(/\{size}/g,n.getSize(a)).replace(/\{width}/g,o).replace(/\{indicator}/g,"").replace(/\{indicatorTitle}/g,"")}},p=function(e,t){return t=t||0,"number"==typeof e?e:("string"==typeof e&&(e=parseFloat(e)),isNaN(e)?t:e)},u=function(){return!(!window.File||!window.FileReader)},f=function(){var e=document.createElement("div");return!s(9)&&(void 0!==e.draggable||void 0!==e.ondragstart&&void 0!==e.ondrop)},m=function(){return u()&&window.FormData},g=function(e,t){e.removeClass(t).addClass(t)},G={showRemove:!0,showUpload:!0,showZoom:!0,showDrag:!0,removeIcon:'',removeClass:"btn btn-xs btn-default",removeTitle:"Remove file",uploadIcon:'',uploadClass:"btn btn-xs btn-default",uploadTitle:"Upload file",zoomIcon:'',zoomClass:"btn btn-xs btn-default",zoomTitle:"View Details",dragIcon:'',dragClass:"text-info",dragTitle:"Move / Rearrange",dragSettings:{},indicatorNew:'',indicatorSuccess:'',indicatorError:'',indicatorLoading:'',indicatorNewTitle:"Not uploaded yet",indicatorSuccessTitle:"Uploaded",indicatorErrorTitle:"Upload Error",indicatorLoadingTitle:"Uploading ..."},v='{preview}\n\n',h='{preview}\n\n{remove}\n{cancel}\n{upload}\n{browse}\n',w='',_='×
\n',b='',C='\n',x='',y='{icon} {label}',T='{icon} {label}
',F='',k='\n',E='',$="
({sizeText})",S='',I='\n \n {drag}\n
{indicator}
\n
\n
',P='\n',D='',z='',A='{dragIcon}',U='\n',L=U+' title="{caption}" '+a+'>
\n',Z="
{footer}\n
\n",B="{content}\n",O='
{data}
\n",R='
\n",M='
\n",N='
\n",H='
\n",q='
\n",W='
\n",V='