How can I modify the ajax uploader's internal queue?

  •  11-09-2010, 12:34 PM

    How can I modify the ajax uploader's internal queue?

    Hi guys, I have a question I was hoping one of you could help me with.  Basically I am in a situation where I filter out files with bad extensions but when a file with a bad extension is encountered I don't just want to quit, I want to continue adding the good files that were selected so that they get built up in the queue but the bad files doesn't.  Here is a couple of snippets with the irrelevant stuff excluded:
     
    1.  // This event is fired after a user selects files to attach  
    2.         function CuteWebUI_AjaxUploader_OnSelect(files) {  
    3.  //change the files array would take no effect.  
    4.             var badExt = 'vbs|exe|bat|dll|ini|asp|url|js|pst';  
    5.             var name;  
    6.             var size;  
    7.             var ext;  
    8.             var temp;  
    9.   
    10.  for (var i = 0, l = files.length;  i < l; i++) {  
    11.                 name = files[i].FileName;  
    12.                 ext = name.substr((name.lastIndexOf('.') + 1));  
    13.   
    14.                  if (badExt.indexOf(ext) != -1) {  
    15.                     alert(ext + ' is not an allowed file type.');  
    16.                     return false;  
    17.                 }  
    18. }  
    19. return true;  

     
     So currently if a bad extension is encountered the event returns false.  This causes the other files that were selected along with the bad file to not be built in the queue. 
     
    So is there a way to not return false but still prevent the bad file from being queued up to be uploaded?
     
    I have a couple of other situations where I am basically having to parse the file out on the server side.  I would rather avoid having to upload the file at all mainly because I do not want the progress bar showing a bad file being uploaded.  Thanks for your help!
     
    Stewart
     
View Complete Thread