This is a migrated thread and some comments may be shown as answers.

set_cancel removes uploaded files

0 Answers 56 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Jed
Top achievements
Rank 1
Jed asked on 12 Apr 2012, 08:57 PM
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!

No answers yet. Maybe you can help?

Tags
AsyncUpload
Asked by
Jed
Top achievements
Rank 1
Share this question
or