I have written one jquery code of upload files with Web Handler. It works fine but i want to check if file’s extension is not matching with my criteria than it will not allow to upload the file..
Here is my code
$(document).ready(function () {
var button = $('#fuAttachment'), interval;
$.ajax_upload(button, {
action: 'FileUploader.ashx',
name: 'myfile',
onSubmit: function (file, ext) {
if (ext == "js") {
alert(ext);
}
// this.disable();
},
onComplete: function (file, response) {
window.clearInterval(interval);
$('<li></li>').appendTo('.files').text(file);
}
});
});
I am getting the extension in ext variable.
I can check it also but still if file contain that extension than want to break upload operation.
How can i do this?? please help ME if anybody knows..
You could return
falsefrom theonSubmitfunction to prevent the file upload if some condition is not satisfied: