I have certain uploaded file code as following:
<script>
var input_file = document.getElementById('txt_list');
input_file.onchange = function() {
var file = this.files[0];
var reader = new FileReader();
reader.onload = function(ev) {
//myProcesses
};
reader.readAsText(file);
};
</script>
How can I add new function to determine the type of uploaded file either txt, gif, etc? and if i have to validate it, what am i supposed to do then?
Thanks in advance
or
please refer this link for more details –LINK
if u need a txt file only
save it to a variable and use a if else statement to verify it