Search code examples
javascriptuploadify

Uploadify check progress


I need disable submit button while the file is uploading..

<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);
   }
});

But this isn't working..

EDIT

The correct solution:

    $('#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");
        }
  });

Solution

  • $('#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")
             }
    });