Hi, in my current project I used a AsyncFileUpload control from AJAX Control Toolkits. After I got the async file upload part working, I needed to filter the file type so users can only upload image files. I found the following code off web and it worked well:
function uploadStarted(sender, args) {
var filename = args.get_fileName();
var filext = filename.substring(filename.lastIndexOf(".") + 1);
if (filext == "jpg" || filext == "jpeg" || filext == "gif" || filext == "bmp") {
return true;
}
else
{
// force uploading cancel
args.set_cancel(true);
// set reason of cancel
args.set_errorMessage("Invalid File Format Selected");
return false;
}
}
The problem is : I don't understand this javascript. What is the type of args parameter? Where are the methods such as "get_fileName()", "set_cancel()" defined? I went to the homepage of the AsyncFileUpload control but couldn't find any documentation regarding the "args".
Can someone help me out explaining this Javascript? Thanks