Skip to content

Instantly share code, notes, and snippets.

@olsgreen
Last active August 29, 2015 14:23
Show Gist options
  • Save olsgreen/fe87c4394f6fb3c19bd7 to your computer and use it in GitHub Desktop.
Save olsgreen/fe87c4394f6fb3c19bd7 to your computer and use it in GitHub Desktop.
Concrete 5.7.x Multiple File Selection
// Wire the trigger to show the file manager dialog
$('#addImageBtn').click(function () {
// Launch the dialog
ConcreteFileManager.launchDialog(function (data) {
// Parse the callback data to get more file detail
ConcreteFileManager.getFileDetails(data.fID, function(r) {
// Loop over each file and do whatever you want with it
for(var i = 0; i < r.files.length; i++) {
// Do whatever with each file
console.log(r.files[i]);
/* Above will output
{
canCopyFile: 1
canDeleteFile: 1
canEditFile: true
canEditFilePermissions: 1
canReplaceFile: 1
canViewFile: true
description: null
fID: 18
fileName: "boxes.jpg"
genericTypeText: "Image"
resultsThumbnailImg: "<img src="http://dev.box/concrete-five-seven/application/files/thumbnails/file_manager_listing/8914/1938/2867/boxes.jpg" data-at2x="http://dev.box/concrete-five-seven/application/files/thumbnails/file_manager_listing_2x/8914/1938/2867/boxes.jpg" />"
title: "boxes.jpg"
url: "http://dev.box/concrete-five-seven/application/files/8914/1938/2867/boxes.jpg"
urlDownload: "/concrete-five-seven/index.php/download_file/view/18"
urlInline: "/concrete-five-seven/index.php/download_file/view_inline/18"
}
*/
}
});
}, { 'multipleSelection' : true });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment