function assignFile(obj){
var file2 = document.querySelector('#fileData');
file2.files = obj.files;
console.log(file2.files);
}
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="fileData[]" id="fileData" multiple="" style="display: none;" />
File: <input type="file" id="file" name="file" onchange="assignFile(this)" />
<input type="submit" name="submit" value="Submit" />
</form>
I have two file fields. I want to assign file
data to fileData
field.
I have posted my code. This code working fine in chrome. But not working in mozilla. Could you please check.