how to determine type of file using javascript when onload?
<p>I have certain uploaded file code as following:</p>

<pre><code>&lt;script&gt;
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);
        };
&lt;/script&gt;
</code></pre>

<p>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</p>
