• Hallo,
    I would need refresh upload page after all files uploaded. Could you hint me is there a hook i can use for this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Not really, but it’s not what you should be looking for if I’m understanding you correctly. Page refreshes are client side, WP hooks are server side. Server side PHP cannot refresh pages, but client side JavaScript or jQuery can. Uploads are done asynchronously via Ajax, so the server never really knows when it’s done, it just no longer gets requests. It sits and waits until one comes in. That’s what servers do ??

    It appears that when the uploads are done, the JS function uploadComplete() is called. It is declared in /wp-includes/js/plupload/handlers.js (line 263). You can override this function by copying it, adding your own code after the jQuery call. As long as your JS file is loaded after handlers.min.js (registered handle “plupload-handlers”), your function will be used.

    Completely untested, but it looks viable. I cannot tell if it is upload complete for one file or all files. It appears to be for all files.

    Thread Starter kamtcho

    (@kamtcho)

    Thank you, i will try and let you know.

    Well Hooks are at server level and not at client( Browser level).

    So you need to check which event at DOM level will be okay for you.
    Check this link
    https://developer.mozilla.org/en-US/docs/Web/Events/load

    Probably load event is the one you should use.

    There you need to use Ajax to call your Word press PHP file and you can then place a hook to achieve your objective.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hook after all images uploaded’ is closed to new replies.