Use a temporary variable to store the name of the file name, which you can check with the following file selection:
var filenameTemp = null; document.getElementById('filePicker').onchange = function(e) { var filename = e.target.value; if (filename !== filenameTemp) { filenameTemp = filename; console.log('OK');
Demo
source share