Using browser firefox and chrome
I have an input file element.
<input type='file' id='tempFileInput' multiple></input>
Let say I have selected three files for the above file input box ('tempFileInput');
OnChange I want to separate three files into three new file input boxes for each file. i.e
<input type='file' id='inputFile_0'></input>
<input type='file' id='inputFile_1'></input>
<input type='file' id='inputFile_2'></input>
I'm struggling to achieve this. Any help?
//I have written a small JavaScript snippet towards what I wana achieve.
var index = 0;
function multipleInputBoxes(tempFileInput){
var divForm = document.getElementById('divForm');
var numOfFiles = tempFileInput.files.length;
for(var i=0; i<numOfFiles; i++){
var newUploader = document.createElement('input');
newUploader.type='file';
newUploader.id = 'inputFile_' + index;
var file = tempFileInput.files[i];
***newUploader.files[0] = file;***
//above line does not work, as by default due to security reasons input type='file' is read only, and non editable.
divForm.appendChild(newUploader);
index++;
}
}