#1 June 10, 2013 9:31am

asiral
Member
Registered: May 18, 2013
Posts: 43

Batch Uploading Files

Wanted to share the method I used to batch upload files.  There is a great plugin out there called Dropzone.  I included the CSS and Javascript in the admin panel and in my custom CSS, overwrote the BigTreeFileManager.addFile method.

This basically creates the dialog like the original function but with the content and some other parameters changed (final parameter for onCancel no longer applies) and stores the dialog in a variable.  The footer is in the form originally, so we remove the footer, apply the dropzone class to the form, append the footer to the dialog (for a close button which does not need to be in the form) and apply Dropzone to the form.

BigTreeFileManager.addFile = function() {
        var dialog = new BigTreeDialog("Upload File",'<input type="hidden" name="folder" value="' + this.currentFolder + '" />',false,"folder",false,"Upload File",true,this.finishedUpload);
        dialog.dialogWindow.find("form").addClass("dropzone").find("footer").remove();
        dialog.dialogWindow.append('<footer><a class="button bigtree_dialog_close">Close</a></footer>').find(".bigtree_dialog_close").click(function() { $(".bigtree_dialog_overlay").last().remove(); BigTreeFileManager.finishedUpload(); });
        var myDropzone = new Dropzone(".dropzone", { url: "admin_root/ajax/file-browser/upload/" });
        return false;
    };

It's a great library and I think worth considering for inclusion in the next release.

Offline

#2 June 10, 2013 10:03am

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 974

Re: Batch Uploading Files

Very cool! We'll keep Dropzone in mind as we explore the File Manager updates in the 4.1 release. Ben here at Fastspot is also a big fan of Dropzone.

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.