set_cancel removes uploaded files

1 posts, 0 answers
  1. Jed
    Jed avatar
    16 posts
    Member since:
    Apr 2009

    Posted 12 Apr 2012 Link to this post

    I have a file explorer using asyncupload. I added a radconfirm when the user closes the upload window letting them know that that action would cancel any files being uploaded. The problem is that if the user clicks cancel instead of ok in the confirm window when they return to the upload window all the uploaded files have been canceled. Is there a way to prevent this? Here is the function I use:

    function OnClientLoad(oExplorer, args) {
                var oWindowmanager = oExplorer.get_windowManager();
                function resetUploadWindow(oWindow, args) {
                    if (oWindow.get_id().endsWith("Upload")) {
                        function onClientBeforeClose(sender, arg) {
                            function callbackFunction(arg) {
                                if (arg) {
                                    sender.remove_beforeClose(onClientBeforeClose);
                                    sender.close();
                                }
                            }
                            arg.set_cancel(true);
                            radconfirm("Warning: If you close this window before the file(s) have completed uploading and before clicking the upload button, the file(s) will not be saved. Do you want to close the upload window?", callbackFunction, 400, 100, null, "Warning");
                        }
                        oWindow.add_beforeClose(onClientBeforeClose);
                    }
                }
                oWindowmanager.remove_show(resetUploadWindow);
                oWindowmanager.add_show(resetUploadWindow);
            }

    Thanks!
Back to Top