hayageek / jquery-upload-file

jQuery Upload File plugin provides Multiple file Uploads with progress bar.Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.
http://hayageek.com/
MIT License
682 stars 417 forks source link

deleteCallback confirmation #179

Closed drewlsvern closed 6 years ago

drewlsvern commented 6 years ago

I am trying to implement a custom confirmation upon deleteCallback. It seems as though the deleteCallback automatically removes the .ajax-file-upload-statusbar div from the DOM even if you don't end up making an ajax, or even if it is not successful.

Is there a way to return false (or something else) within the callback function?

Please advise.

hayageek commented 6 years ago

You need to customize the plugin, right now there is no option.

web-reteradioazzurra commented 4 years ago

I add a confirm alert before deletecallback near line 248

ORIGINAL CODE: if(s.showDelete) { pd.del.show(); pd.del.click(function () { pd.statusbar.hide().remove(); var arr = [filename]; if(s.deleteCallback) s.deleteCallback.call(this, arr, pd); obj.selectedFiles -= 1; updateFileCounter(s, obj); }); }

MODIFIED CODE

        if(s.showDelete)
        {
        pd.del.show();
            pd.del.click(function () {
            var conferma=confirm("Confirm?");
            if (conferma== true){
                pd.statusbar.hide().remove();
                var arr = [filename];
                if(s.deleteCallback)  s.deleteCallback.call(this, arr, pd);
                obj.selectedFiles -= 1;
                updateFileCounter(s, obj);
                }
            });
        }