0

I have one form with uploadify as one of the component. I am submitting my entire form via Ajax. But problem is that, I want to reset uploadify component after ajax response comes.

Please tell me if you know any way to reset that component entirely.

Thanks for your help.

Hussain

2
  • does reset mean to clear the queue ? Dec 19, 2012 at 5:32
  • Hussain, This is very old ques though, did you got any solution for this? Because I am also facing same problem. If you got any, please share here. That will be useful.
    – KAsh
    May 29, 2014 at 7:16

3 Answers 3

0

I don't know what you mean exactly be "reset the form", can't you do something like this?

$.ajax({
    url: 'something.php',
    // other params
    success: function(response) {
        $('#fileUpload').uploadify({
        'uploader'  : '../js/uploadify/uploadify.swf',
        'script'    : '../js/uploadify/uploadify.php',
        'cancelImg' : '../js/uploadify/cancel.png',
        'folder'    : '../uploads',
        'auto'      : true
                    // bla bla bla
    });
    }
}

You pratically re-uploadify the form on the onSuccess callback of the AJAX call. Posting your JS/HTML and exaplaining what you exactly mean by "reset" will get you better answers, I think.

1
  • 1
    I have already initialized Uploadify when page is loaded, now user submits the data via ajax. once ajax all is successfull, I want to reinitialize/reset uploadify completely.
    – eHussain
    Jan 28, 2011 at 3:12
0
$('#file_upload').uploadify('destroy')

Calling destory will reset the uploadify back to it's original state.

More info about destroy is here

0

Got the solution

we need to just remove the title i.e. name of the uploaded file from uploadify controller.

for example, in my page I have span which holds the name of file. So at the time of uplodify initialization it will be like this

<label id="lbl">No file selected</label>

after uploading file this will be converted to

<label id="lbl">img1.png</label>

Now after the ajax call we can just remove the text from the span and the uploadify is reset ed back.

$("#lbl").html('No file selected');

I have used this when I am deleting the uploaded image. And it worked for me. Hope it helps others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.