you can simply do it by comparing files name.
arr = [];
function onFileInput(e) {
let files = e.target.files;
for (let i = 0; i < files.length; i++) {
if (arr.indexOf(files[i].name) === -1) {
arr.push(files[i]);
}
}
}
CLICK HERE to find out more related problems solutions.