have working on it and added a code for push... but the problem is. if i upload 2 files then the first file only get updated in array. the 2nd file didn't get updated. In array, the 1st file is only get defined 2 times. here is the code. please tell me where i am doing wrong.
var handleFileSelect = function(evt) {
var files = evt.target.files;
var fileDetail= [];
for(var i= 0; i<files.length; i++)
{
var file = files[i];
var reader = new FileReader();
reader.onload = function(readerEvt) {
var binaryString = readerEvt.target.result;
var base64 = btoa(binaryString);
var fName = files.item(name).name; // 1st time file get updated. but 2nd time 2nd file came but ".item(name)" didn't get updated.
var fType = files.item(name).type; // same here 2nd file item(name) didn't get updated.
fileDetail.push(fName,fType);
if(typeof base64file == "undefined" || typeof base64file == null)
{
base64file = base64;
}
else
{
base64file = base64file +'new'+base64;
}
};
reader.readAsBinaryString(file);
}
};
if (window.File && window.FileReader && window.FileList && window.Blob) {
// document.getElementById('oUploadCollection').addEventListener('change', handleFileSelect, false);
var viewId = this.getView().getId();
var b = document.getElementById(viewId + "--UploadCollection");
b.addEventListener('change', handleFileSelect, false);
} else {
alert('The File APIs are not fully supported in this browser.');
}