Topic: From v2.0.0 to v2.1.x - settings & browse_button not working anymore
The code below is what I've been using with version 2.0.0a and 2.0.0beta and it works on those versions. But when I change the plupload files to version 2.1.0, 2.1.1 or the current nightly, the exact same code doesn't work anymore:
//start plupload
$(function() {
var listerrors = {}; //used to display errors via log() as in examples
//start settings
var uploader = new plupload.Uploader({
runtimes: 'html5,flash',
browse_button: 'fileUpload',
container: 'fileQueue',
url: 'plupload/examples/upload.php',
drag_drop: false,
drop_element: 'fileQueue',
max_file_size: '25mb',
chunk_size : '0',
unique_names: true,
prevent_duplicates: true,
sortable: false,
flash_swf_url: 'plupload/js/Moxie.swf',
filters: [
{title : "Image files", extensions : "jpg,jpeg,png,bmp"}
],
// PreInit events, bound before any internal events
preinit : {
Init: function(up, info) {
log('[Pre-Init]', 'Info:', info, 'Features:', up.features);
$('#fileQueue').empty(); //EDIT: <<--- this line stopped working in 2.1.x, see first reply below
},
},
// Post init events, bound after the internal events
init : {
//only contains some events with the log() function like in the examples
}
}); //end settings
uploader.bind('Init', function(up, info) {
log('[Init]', 'Info:', info, 'Features:', up.features);
});
uploader.bind('Error', function(up, err) {
listerrors[err.file.id+'msg'] = err.message;
listerrors[err.file.id+'code'] = err.code;
log('[listerrors]', listerrors);
up.refresh(); //Reposition Flash/Silverlight
});
$('#uploadfiles').click(function(event) {
uploader.start();
event.preventDefault();
});
uploader.init();
}); //end plupload
Using:
jQuery 2.0.3 although I've tried a bunch of different versions as well.
plupload.full.min.js
The HTML simply contains a button with the id for the browse_button, it's not hidden or disabled:
<button id="fileUpload">Select files</button>
The log() thing on both pre-init and init shows me this on 2.1.0, 2.1.1 and nightly:
[Pre-Init] Info: runtime=html5 Features: chunks=true, multipart=true, multi_selection=true, dragdrop=true
[Init] Info: runtime=html5 Features: chunks=true, multipart=true, multi_selection=true, dragdrop=true
So Plupload does get initialized but doesn't disable chunks and dragdrop from the settings, and the browse button doesn't open the files window. I bet it's just completely ignoring all options I've set, which in turn stops the browse_button from working as it's also defined in the settings. The upload button does work since that's separately defined in a click event and not in the settings. Also the log() shows the 'started/stopped' statechanged even without files selected if I click the upload button, so Plupload is running for sure.
What has changed since 2.0.0a that makes a previously working script to stop working? Did the settings section change? As far as I can see from the current examples, this should still work...
-----
This probably has no significance, but it shows other info on the older versions. I believe that was just not implemented yet back then, I remember even earlier versions did show features but these didn't:
2.0.0beta
[Pre-Init] Info: runtime=html5 Features:
[Init] Info: runtime=html5 Features:
2.0.0a
[Pre-Init] Info: runtime=Generic Features:
[Init] Info: runtime=Generic Features: