上传检查进度

时间:2014-04-09 19:55:32

标签: javascript uploadify

我需要在文件上传时禁用提交按钮..

<button type="submit" id="submit_button" class="btn btn-default">Odeslat</button>

JS:

$('#file_upload').uploadify({
   'swf' : 'css/uploadify.swf',
   'uploader' : 'uploadify.php?galerie=<?php echo $n; ?>',
   'onUploadProgress' : function(file) {
       $('#submit_button').prop('disabled', true);
   }
});

但这不起作用..

修改

正确的解决方案:

    $('#file_upload').uploadify({

        'swf': 'css/uploadify.swf',
        'uploader' : 'uploadify.php?galerie=<?php echo $n; ?>',
        'onUploadProgress' : function(file) {
            $('#submit_button').attr('disabled', 'disabled');
        },
        'onUploadComplete': function(file) {
            $('#submit_button').removeAttr("disabled");
        }
  });

1 个答案:

答案 0 :(得分:-1)

$('#file_upload').uploadify({
   'swf' : 'css/uploadify.swf',
   'uploader' : 'uploadify.php?galerie=<?php echo $n; ?>',
   'onUploadProgress' : function(file) {
       $('#submit_button').attr('disabled', 'disabled');
   },
   'onComplete': function(event, queueID, fileObj, response, data) {
                   $('#submit_button').removeAttr("disabled")
         }
});