Thursday, August 10, 2017

uploadifive - clearing queue on the the submitting of form

Leave a Comment

I am using uploadifive plugin for multi-file uploading. It works great but now i have find a bug in my implementation that queue is not clearing after creating a record. If record is created then uploadifive should show empty queue for new record but it shows old queued files which were previously uploaded. My logic is Ajax and java-script driven and i am not refreshing page after form get submitted(if page refreshed then queue is white and clean which is obvious :) ).

Following is the code which i used to activate uploadifive for my file type input:

$('#xyz_uploader').uploadifive({     'fileTypeDesc' : 'Image Files',     'fileTypeExts' : '*.png;*.jpg;*.jpeg',     'fileType'  : ['image/png','image/jpg','image/jpeg'],     'auto'             : false,     'checkScript'      : 'uploadify_envc.php?checkexist=true',     'formData'         : {         'timestamp' : curDateTime,          'token'     : 'df324523adg34qtfgiui',         'doc_type'     : 'docs',         'somenewval'     : $("select#dropdown_control").val(),     },     'buttonText'          : 'Upload Document(s)',     'queueID'          : 'xyz_uploader_queue',     'auto'     : true,     'uploadScript'     : 'uploadify_envc.php?injury='+$("select#dropdown_control").val(),     'onUploadComplete' : function(file, data) { HandleUploadiFiveDocs(file,data,"docs");    } }); 

When i submitting data using JS function, i call this function in return of Ajax call to clear queued files:

    $('#xyz_uploader').uploadifive('clearQueue'); 

But this is not working. I have tested it via browser console and in java-script function but both are not working.

So can you guys tell me that how can i clear uploadifive queue using java-script command?

1 Answers

Answers 1

first using

$('#xyz_uploader').uploadifive('destroy')  

and then re-constructing object worked for me. Like following :

$('#xyz_uploader').uploadifive({     'fileTypeDesc' : 'Image Files',     'fileTypeExts' : '*.png;*.jpg;*.jpeg',     'fileType'  : ['image/png','image/jpg','image/jpeg'],     'auto'             : false,     'checkScript'      : 'uploadify_envc.php?checkexist=true',     'formData'         : {         'timestamp' : curDateTime,          'token'     : 'df324523adg34qtfgiui',         'doc_type'     : 'docs',         'somenewval'     : $("select#dropdown_control").val(),     },     'buttonText'          : 'Upload Document(s)',     'queueID'          : 'xyz_uploader_queue',     'auto'     : true,     'uploadScript'     : 'uploadify_envc.php?injury='+$("select#dropdown_control").val(),     'onUploadComplete' : function(file, data) { HandleUploadiFiveDocs(file,data,"docs");    } }); 

Try it and it will work for you guys as well. i have found that while looking into core functions. Anyhow it was disappointing to get no support from here.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment