Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

"Bug with jgrowl onComplete"
  • Hi there,

    I've lately downloaded uploadify and want to use it at my website.

    Yesterday I noticed a bug with the jgrowl.

    I limited file size to 5 MB and used single upload mode.

    I did following steps and got error.

    1. Tried upload file more than 5 MB and got error jgrowl message.
    2. Tried upload another file more than 5 MB and got error jgrowl message once again.
    3. Finally uploaded file less than 5 MB and got three Upload complete messages of last file.

    However, I should get one complete message.

    When I checked DB I saw the file is uploaded twice.

    Is it possible to fix it?

    Here is the source code which I am using:

    <!--========================================= UPLODIFY =========================================//-->
    <link rel=\"stylesheet\" href=\"<?php echo $this->baseUrl() ?>/library/uploadify/uploadify/uploadify.css\" type=\"text/css\" />
    <link rel=\"stylesheet\" href=\"<?php echo $this->baseUrl() ?>/library/uploadify/css/uploadify.jGrowl.css\" type=\"text/css\" />

    <script type=\"text/javascript\" src=\"<?php echo $this->baseUrl() ?>/library/uploadify/js/jquery.uploadify.js\"></script>
    <script type=\"text/javascript\" src=\"<?php echo $this->baseUrl() ?>/library/uploadify/js/jquery.jgrowl_minimized.js\"></script>
    <script type=\"text/javascript\">

    var hasAttach = false;

    $(document).ready(function() {
    $(\"#fileUploadgrowl\").fileUpload({
    'uploader': '<?php echo $this->baseUrl() ?>/library/uploadify/uploadify/uploader.swf',
    'cancelImg': '<?php echo $this->baseUrl() ?>/library/uploadify/uploadify/cancel.png',
    'script': '<?php echo $this->url(Constants::getSiteUrl('community|topicAttachCtrlAct'), null, true) ?>',
    'folder': '<?php echo $this->baseUrl() ?>/library/uploadify/files',
    'sizeLimit': 5242880,
    onError: function (event, queueID ,fileObj, errorObj) {
    var msg;
    if (errorObj.status == 404) {
    alert('Could not find upload script. Use a path relative to: '+'<?= getcwd() ?>');
    msg = 'Could not find upload script.';
    } else if (errorObj.type === \"HTTP\")
    msg = errorObj.type+\": \"+errorObj.status;
    else if (errorObj.type ===\"File Size\")
    msg = fileObj.name+'<br>'+errorObj.type+' Limit: '+Math.round(errorObj.sizeLimit/1048576)+'MB';
    else
    msg = errorObj.type+\": \"+errorObj.text;
    $.jGrowl('<p></p>'+msg, {
    theme: 'error',
    header: 'ERROR',
    sticky: true
    });
    $(\"#fileUploadgrowl\" + queueID).fadeOut(250, function() { $(\"#fileUploadgrowl\" + queueID).remove()});
    hasAttach = false;
    return false;
    },
    onCancel: function (a, b, c, d) {
    var msg = \"Cancelled uploading: \"+c.name;
    $.jGrowl('<p></p>'+msg, {
    theme: 'warning',
    header: 'Cancelled Upload',
    life: 4000,
    sticky: false
    });
    hasAttach = false;
    },
    onClearQueue: function (a, b) {
    var msg = \"Cleared \"+b.fileCount+\" files from queue\";
    $.jGrowl('<p></p>'+msg, {
    theme: 'warning',
    header: 'Cleared Queue',
    life: 4000,
    sticky: false
    });
    hasAttach = false;
    },
    onComplete: function (a, b ,c, d, e) {
    var size = Math.round(c.size/1024);
    $.jGrowl('<p></p>'+c.name+' - '+size+'KB<br>You are redirecting...', {
    theme: 'success',
    header: 'Upload Complete',
    life: 2000,
    sticky: false
    });
    setTimeout(\"changeLocation('<?php echo $this->baseUrl()?>/community/forums/viewforum/forum/' + document.getElementById('forums').value)\", 3000);
    },
    onSelect : function (event, queueID ,fileObj) {
    hasAttach = true;
    }
    });

    $('#subject').bind('change', function(){
    $('#fileUploadgrowl').fileUploadSettings('scriptData','&amp;forum_code='+ $(\"#forums\").val() +'&amp;topic_title='+$(this).val() + '&amp;post_text=' + $(\"#message\").val() + '&amp;user_role=<?php echo $this->userRole ?>&amp;user_id=<?php echo $this->userID ?>');
    });

    $('#forums').bind('change', function(){
    $('#fileUploadgrowl').fileUploadSettings('scriptData','&amp;forum_code='+ $(this).val() +'&amp;topic_title='+$(\"#subject\").val() + '&amp;post_text=' + $(\"#message\").val() + '&amp;user_role=<?php echo $this->userRole ?>&amp;user_id=<?php echo $this->userID ?>');
    });

    $('#message').bind('change', function(){
    $('#fileUploadgrowl').fileUploadSettings('scriptData','&amp;forum_code='+ $(\"#forums\").val() +'&amp;topic_title='+$(\"#subject\").val() + '&amp;post_text=' + $(this).val() + '&amp;user_role=<?php echo $this->userRole ?>&amp;user_id=<?php echo $this->userID ?>');
    });

    $('#submit_btn').click(function(){
    if (hasAttach) {
    $('#fileUploadgrowl').fileUploadStart()
    } else {
    document.getElementById('postForumTopicForm').submit();
    }
    });

    });

    </script>
    <!--========================================= END OF UPLODIFY =========================================//-->