Hello,
I am trying to implement a multiple file drag and drop feature. It is implemented successfully with multiple dialogues showing for confirming if file is private or public however, that could be tedious/clumsy when uploading 10+ files. So a suggestion was to have one grid with multiple checkboxes. This is also implemented
My fix was to create the new function below, replacing the upload_file function with my function call in the setup_drag_drop function of form.js and file_list.js :
multifile_upload:function(fileobjs, args, opts) {
var fields = []; //loop through filenames and append for (var i =0,j = fileobjs.length;i<j;i++) { var filename = fileobjs[i].name; fields.push({'fieldname': 'label1', 'fieldtype': 'Read Only', 'label': filename}); } //insert a column break fields.push({'fieldtype': 'Column Break'}); //loop through checkboxes and append for (var i =0,j = fileobjs.length;i<j;i++) { fields.push({'fieldname': 'is_private', 'fieldtype': 'Check', 'label': 'Private', 'default': 1}); } var d = new frappe.ui.Dialog({ 'title': __('Make file(s) private or public?'), 'fields': fields, primary_action: function(){ for (var i =0,j = fileobjs.length;i<j;i++) { frappe.upload.upload_file(fileobjs[i], args, opts); } } }); d.show(); opts.confirm_is_private = 0
}
}
however, there is an issue handling the request somewhere as I get the following error
I don’t have a traceback in my bench console which I know would have been preferable to post up here.
Any help would be appreciated. Thanks.