Jquery validate file ext on upload
<p>I have a page for allowing users to upload their images using drag and drop and I would like to restrict them to uploading jpg files only.</p>

<p>I have to admit I am a complete newbie when it comes to jquery so I really don't have a clue how to make this work.</p>

<p>So far I have</p>

<pre><code>var files = e.dataTransfer.files;
var ext = $('#drop-files').val().split('.').pop().toLowerCase();


// Show the upload holder
$('#uploaded-holder').show();

// For each file
$.each(files, function(index, file) {
    if($.inArray(ext, ['JPG','jpg','jpeg']) == -1) {
           alert('invalid extension!');
           return false;
       }
</code></pre>

<p>As this is it does nothing, if I remove the 'return false' it tells me every file is invalid and uploads them anyway.</p>

<p>Thanks</p>

<p>btw, I am aware that there are unclosed brackets, I'm just hoping the someone will see something obvious I have missed out in the section of code I've supplied</p>
