I've been trying pluploader out to front end upload files to my Photo gallery webpage and it works well. Basically just followed the examples on the website. But I would like to disable the Add files button initially until user has selected an upload destination "album" which they do by pressing a button click handler I implemented (see album-select onclick below). I have managed to disable the Add button in the constructor as shown, but I'm having no luck re-enabling it when user presses the album button. Any ideas how to implement re-enabling the Add files button from my own button press? Thanks!
<script type="text/javascript">
var uploader = $("#upl").plupload({
// General settings
url : g_homeUrl + "get-from-browser/",
// Maximum file size
max_file_size : '10mb',
// Specify what files to browse for
filters : [
{title : "Image files", extensions : "jpg,jpeg,gif,png"}
],
// Sort files
sortable: true,
// Enable ability to drag'n'drop files onto the widget (currently only HTML5 supports that)
dragdrop: true,
// To disable Add files button.
buttons: {
browse: false
},
// Views to activate
views: {
list: true,
thumbs: true, // Show thumbs
active: 'thumbs'
}
});
uploader.init();
uploader.bind('complete', function(up, fl){
console.log('Completed uploading ' + fl.files.length + " files");
});
uploader.bind('error', function(up, err) {
document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message;
});
document.getElementById('album-select').onclick = function(e) {
albSet = e.target.dataset.album;
var albTitle = e.target.dataset.title;
var html = "Upload to album " + albTitle + "<br/>";
html += "Click add files to select your images for upload";
document.getElementById('console').innerHTML = html;
// How to enable browse (Add files) button if disabled in constructor?
//uploader.disableBrowse(false) says not a function??
}
</script>