title: How cancel files from queue programmatically in JQuery File Upload Plugin?
body: <p>When user add a file into queue I must validate so I wrote a function in callback:</p>
  
  <pre><code>$(document).ready( function() {
  $('#fileupload').bind('fileuploadadd', function (e, data) {
      $.each(data.files, function (index, file) {
          check = ValidaDoc(file.name);
          if (check!="OK"){
              var erro="";
              if (check=="Alerta1"){
                  alert("Alerta1");
              }
              else {
                  errotemp="";
                  if(check=="Erro1"){erro=erro + file.name + " com extensão não esperada.";}
                  else if(check=="Erro2"){erro=erro + file.name + " não cadastrado ou com nome fora do padrão.";}
                  $($('#fileupload .files .cancel button')[index]).click();
          }
      }
  });
  });
  </code></pre>
  
  <p>The callback works, the ValidaDoc function works and a file is canceled but not the right one. I think the index use is no right. Anyone have a ideia?</p>