开发者

How to disable Ajax-upload button?

开发者 https://www.devze.com 2023-02-13 06:58 出处:网络
I\'m trying to use this plugin http://valums.com/ajax-upload/. I added a file-limit, I want to disable the upload button (not hide, just disable).

I'm trying to use this plugin http://valums.com/ajax-upload/. I added a file-limit, I want to disable the upload button (not hide, just disable). E.g.

if(filesNumber>=limit)
{
    //Disable the "Upload a file" button    
}

So, if the user will try to upload another file, he should see a message that the limit is exceeded. Can you look at this plugin and help me?

The button is not a form button, it is a div with css.

var btnUpload=$('#<?=$filesManagerCode?>upload');
        new AjaxUpload(btnUpload, {
            action: '<?=$boxLink?>actionMode<?=LDTR?>addfile',
            name: 'uploadFile[FilePath]',
            onSubmit: function(file, ext){
                btnUpload.attr('oldContent', btnUpload.html());
                btnUpload.html('<img src="'+jsloader.src+'"/>');
            },
            onComplete: function(file, response, temp){
                btnUpload.html(btnUpload.attr('oldContent'));
                $("#<?=$filesManagerCode?>files").load('<?=$boxLink?>', setFilesLimit(<?=$params['filesLimit']?>));
            }
        });


<div id="<?=$filesManagerCode?>upload" class="uploadButton"><span>Upload file</span> <span id="<?=$filesManagerCode?>up开发者_高级运维loadLimit"></span></div>

Thanks.


    var btnUpload=$('#<?=$filesManagerCode?>upload');
           if(filesNumber>=limit)
{
    //Disable the "Upload a file" button or Do nothing:
       alert("You have reached the upload limit.");
}
else
{
            new AjaxUpload(btnUpload, {
                action: '<?=$boxLink?>actionMode<?=LDTR?>addfile',
                name: 'uploadFile[FilePath]',
                onSubmit: function(file, ext){
                    btnUpload.attr('oldContent', btnUpload.html());
                    btnUpload.html('<img src="'+jsloader.src+'"/>');
                },
                onComplete: function(file, response, temp){
                    btnUpload.html(btnUpload.attr('oldContent'));
                    $("#<?=$filesManagerCode?>files").load('<?=$boxLink?>', setFilesLimit(<?=$params['filesLimit']?>));

            });
}
0

精彩评论

暂无评论...
验证码 换一张
取 消