How to slow down Uploadify plugin script voor jQuery

Posted by Peter on Stack Overflow See other posts from Stack Overflow or by Peter
Published on 2010-06-17T15:40:03Z Indexed on 2010/06/17 15:43 UTC
Read the original article Hit count: 216

Filed under:
|

Now if that isn't a weird question, I don't know what is.

But here is the problem: I have a function in my "onSelect" option that has to collect some data (through AJAX) and I have a function in my "onComplete" option that processes the just uploaded files based on the data "onSelect" collected.

However, with very small files, the "onSelect" hasn't finished yet before the upload is complete and the "onComplete" fails because it lacks the necessary data. Bigger files work just fine.

So, I'm looking for a way to stall the upload of the file. To let it start only after the function in onSelect completed fetching the necessary data.

Any ideas?

Here is an example of the function that the onSelect triggers:

var foo = new Array();

function checkDB( event, queueID , fileObj )
{

    $.post( ajax_folder + 'fetchData' ,
            {
                ref: "someValue"
            } ,
            function( data ){

                foo[ queueID ] = data.result;

            } ,
            'json' );

    return true;
}

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about uploadify