From 393e5ae2de46d2925fb60dcdfb70b155991df139 Mon Sep 17 00:00:00 2001 From: Trindaz Date: Thu, 20 Dec 2012 18:03:37 +1100 Subject: [PATCH] support ie8+ for changing target file --- js/bootstrap-fileupload.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/bootstrap-fileupload.js b/js/bootstrap-fileupload.js index abb9fc69..523f29cf 100644 --- a/js/bootstrap-fileupload.js +++ b/js/bootstrap-fileupload.js @@ -91,7 +91,16 @@ this.$hidden.val('') this.$hidden.attr('name', this.name) this.$input.attr('name', '') - this.$input.val('') // Doesn't work in IE, which causes issues when selecting the same file twice + + //ie8+ doesn't support changing the value of input with type=file so clone instead + if($.browser.msie){ + var inputClone = this.$input.clone(true); + this.$input.after(inputClone); + this.$input.remove(); + this.$input = inputClone; + }else{ + this.$input.val('') + } this.$preview.html('') this.$element.addClass('fileupload-new').removeClass('fileupload-exists')