1 (edited by ba.craf 2015-06-26 00:42:21)

Topic: disable browse not working

I tried to disable the add button as per issue below, but it doesn't work.

https://github.com/moxiecode/plupload/issues/567

Firebug tells me that uploader is not defined.

Actually I am doing this to limit the total number of files added, as it seems that plupload only limits the number of files to be sent at ONE time.

The variable rest_img counts the number of remaining images as compared to the total number I stipulated.

Of course, the code below is part of the whole initialization of plupload, which does not seem necessary to repeat here, and it's working fine otherwise.



 init : {             
        FileUploaded: function() {
            rest_img = rest_img-1;
            },
        
        UploadComplete: function() {
                // Called when all files are either uploaded or failed
                
            if (rest_img == 0) {
                //alert(rest_img);
                uploader.disableBrowse();
            }
            }           
 }   

Re: disable browse not working

And do you actually have uploader variable defined, somewhere above?

Even if you don't, every event handler in Plupload receives uploader object as the first argument, so you can do this:

UploadComplete: function(uploader) {
           // Called when all files are either uploaded or failed
                
           if (rest_img == 0) {
               //alert(rest_img);
               uploader.disableBrowse();
           }
}  
If you want to see your issue fixed, do not report it here, do it on - GitHub.