Check input file for correct format with jquery
<p>I use this code <a href="http://jsbin.com/uboqu3/83/edit#source" rel="nofollow">http://jsbin.com/uboqu3/83/edit#source</a></p>

<pre><code> function readURL(input) {
        if (input.files &amp;&amp; input.files[0]) {
            var reader = new FileReader();

            reader.onload = function (e) {
                $('#blah')
                    .attr('src', e.target.result)
                    .width(180);
            };

            reader.readAsDataURL(input.files[0]);
        }
    }
</code></pre>

<p>I need to check with jquery for correct format. For example if pictures have got jpg than everything is ok and function show picture whitch will be uoloaded. If pictures --> gif, png tahn show alert or div message , input type=file wiill be reset and no picture will be shown. Can someone halp me with this.</p>
