Help me understand that the following javascript is related to managing AsyncFileUpload

In my current project, I used the AsyncFileUpload control from the AJAX Control Toolkits. After I downloaded the download part of the asynchronous file, I had to filter the file type so that users could only upload image files. I found the following code offline, 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 that I do not understand this javascript. What is the type of args parameter? Where are methods such as "get_fileName ()", "set_cancel ()"? I went to the main page of the AsyncFileUpload control, but could not find the documentation regarding "args".

Can someone help me explain this Javascript? Thanks

+3
1

,

, , . , , get_abc(), .

  • get_fileName() get_path()
  • get_length() . null
  • get_contentType() mime . null
  • get_errorMessage() , . null

. :

http://p2p.wrox.com/content/blogs/danm/enter-asyncfileupload-control

+2

Source: https://habr.com/ru/post/1747270/


All Articles