Skip to content

Commit

Permalink
Fix multiple file upload reset issue
Browse files Browse the repository at this point in the history
  • Loading branch information
safrazik committed Nov 18, 2016
1 parent a4bacdf commit 7fc5c9f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions knockout-file-bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,17 @@
checkDoneFileProperties(property);
return true;
}
if(index == 0 && fileData[property + 'Array'] && ko.isObservable(fileData[property + 'Array'])){
fileData[property + 'Array']([]);
}

var reader = new FileReader();
reader.onload = function(e) {
function fillDataToProperty(result, prop){
if (index == 0 && fileData[prop] && ko.isObservable(fileData[prop])) {
fileData[prop](result);
}
if(fileData[prop + 'Array'] && ko.isObservable(fileData[prop + 'Array'])){
if(index == 0){
fileData[prop + 'Array']([]);
}
fileData[prop + 'Array'].push(result);
}
}
Expand Down Expand Up @@ -230,9 +231,6 @@
});
},
update: function(element, valueAccessor, allBindingsAccessor) {

// var fileData = ko.utils.unwrapObservable(valueAccessor());

}
};

Expand Down

0 comments on commit 7fc5c9f

Please sign in to comment.