uploadify - setting cookie in "onComplete" breaks it?

uploadify - setting cookie in "onComplete" breaks it?

Hi,

I'm trying to set a cookie, so I know that a file has been successfully uploaded.

I have:

  1.         onComplete: function(a, b, c, d, e) {
  2.              if (d != '1') {
  3.                 var the_error = d;
  4.                 var content_to_add =  '<b>ERROR:</b> ' + c.name  +  ' - ' + the_error + '<br />';
  5.                 $('#errorList').append(content_to_add).fadeIn('slow');
  6.              } else {
  7.                 $.cookie("viduploaded", "1");
  8.                 var tmp_size = c.size / 1024;
  9.                 var the_size_in_kb = Math.round(tmp_size * 100) / 100;
  10.                 var content_to_add =  '<div id="upload_' + b + '">' + c.name  + ' ( ' + the_size_in_kb + 'kb ) &nbsp; <a href="javascript: void(0);" onclick="remove_image('' + c.name  + '','<%temp_id%>','' + b + '')"><img src="<%config.build_static_url%>/ajax_upload/cancel.png" /></a><br /></div>';
  11.                 $('#successQueue').append(content_to_add).fadeIn('slow');
  12.              }
  13.         }

This seems to break it though:

  1.                 $.cookie("viduploaded", "1");

If I move that line to below:

  1.                 $('#successQueue').append(content_to_add).fadeIn('slow');

...its runs fine BUT the cookie is not set :/

Any suggestions?

TIA!

Andy