Reload (or reinitialise) Uploadify in jQuery UI modal dialog box -


i use uploadify within jquery ui modal dialog box, , using ajax submit data. can reuse modal dialog box upload more files. have working here problem.

when modal box opened second time, , add file using uploadify, appears twice in queue. if open modal box third time, , add file, appear 3 times in queue (and on).

when close modal dialog form, use following code (which called close function of jquery ui modal dialog box):

function destroyuploadifyinstance(){ $('#image_namequeue').remove(); $('#image_nameuploader').remove(); } 

when open modal dialog form, call uploadify code again (this called open function of jquery ui modal dialog box):

function createuploadifyinstance(){ $('#image_name').uploadify({ 'uploader' : 'uploadify.swf', 'script' : 'uploadify.php', 'cancelimg' : 'cancel.png', etc 

i feel there, code works though duplicate files shown (it not upload each file multiple times, once).

how can stop duplicate queue items being displayed? thanks.

uploadify binds handler event uploadifyselect element call on, adds queue items. if don't unbind in destroyuploadifyinstance chain of event handlers grow each call createuploadifyinstance, causes duplicates.

function destroyuploadifyinstance() {     $("#image_name").unbind("uploadifyselect");     $('#image_namequeue').remove();     swfobject.removeswf('image_nameuploader'); } 

this destroy/reinitialize business necessary in ie seems, due way handles flash objects when these hidden, make browser dependent , stick single call uploadify ff, chrome, etc., without "destroying" on each close of dialog.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -