Reputation: 3751
I am trying out plupload on IE9, It works perfectly with Flash installed... But without that the browse button does nothing...I don't find any error in console. Please suggest how to handle this exception so that I can notify user to install Flashplayer
Thanks!
Upvotes: 1
Views: 1106
Reputation: 15413
Here is a modified version of the plupload sample which should do what you want. Main interest point is in the Error handler at the bottom of the code.
var uploader = new plupload.Uploader({
runtimes : 'html5,flash',
browse_button : 'pickfiles', // you can pass in id...
container: document.getElementById('container'), // ... or DOM Element itself
url : 'upload.php',
flash_swf_url : '../js/Moxie.swf',
silverlight_xap_url : '../js/Moxie.xap',
filters : {
max_file_size : '10mb',
mime_types: [
{title : "Image files", extensions : "jpg,gif,png"},
{title : "Zip files", extensions : "zip"}
]
},
init: {
PostInit: function() {
document.getElementById('filelist').innerHTML = '';
document.getElementById('uploadfiles').onclick = function() {
uploader.start();
return false;
};
},
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
});
},
UploadProgress: function(up, file) {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
},
Error: function(up, err) {
if(err.code === plupload.INIT_ERROR)
{
alert('Please install or activate flash player');
}
document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message;
}
}
});
uploader.init();
Upvotes: 1