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:
-
- function CuteWebUI_AjaxUploader_OnSelect(files) {
-
- var badExt = 'vbs|exe|bat|dll|ini|asp|url|js|pst';
- var name;
- var size;
- var ext;
- var temp;
-
- for (var i = 0, l = files.length; i < l; i++) {
- name = files[i].FileName;
- ext = name.substr((name.lastIndexOf('.') + 1));
-
- if (badExt.indexOf(ext) != -1) {
- alert(ext + ' is not an allowed file type.');
- return false;
- }
- }
- 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