cubiclesoft / jquery-fancyfileuploader

A jQuery plugin to convert the HTML file input type into a fancy file uploader under a MIT or LGPL license. Mobile-friendly too!
59 stars 27 forks source link

All files uploaded event? #25

Closed joaopaulobraga closed 2 years ago

joaopaulobraga commented 2 years ago

Is there a way where I can run a code after all the uploads were completed? In my case, I want to refresh or reload the page after all the multiple files have been uploaded. I searched in the plugin but I was unsuccessful. Please any help is very welcome!

Thank you,

Joao

cubiclesoft commented 2 years ago

No such event exists but you can use detection code in an uploadcompleted callback function:

uploadcompleted: function(e, data) {
    var active = $('.ff_fileupload_uploading, .ff_fileupload_starting');
    var queued = $('.ff_fileupload_queued');

    if (!active.length && !queued.length)
    {
        window.location.reload();
    }
}

That code is similar to how the beforeunload handler in the uploader detects uploads that are queued or in progress.

joaopaulobraga commented 2 years ago

Thank you very much, ir worked like a charm.