score:1

Accepted answer
var fileName = document.getElementById('file').value.toLowerCase();
if(!fileName.endsWith('.xml'){
    alert('You can upload xml files only.');
    return false;
}

Related Query

More Query from same tag