Plupload - Event does not fire
I am using the below code to fire an event when the download queue is complete, however I cannot get it to work.
Any ideas?
var uploader = $("#uploader").pluploadQueue(
{
runtimes : 'html5,html4',
url : '/admin/media/image_upload',
max_file_size : '1mb',
unique_names : true,
filters : [{title : "Image files", extensions : "jpg,gif,png"}]
});
uploader.bind('FileUploaded', function(up, file, res)
{
alert('ok');
});
+3
source to share
2 answers
I don't know how relevant this is, but I use it in a slightly different way:
$("#uploader").pluploadQueue(
{
runtimes : 'html5,html4',
url : '/admin/media/image_upload',
max_file_size : '1mb',
unique_names : true,
filters : [{title : "Image files", extensions : "jpg,gif,png"}]
});
var uploader = $("#uploader").pluploadQueue();
uploader.bind('FileUploaded', function(up, file, res)
{
alert('ok');
});
+3
source to share
You may like another way:
Additional properties have been added to your $ ("# uploader"). pluploadQueue () :
init: {
FileUploaded: function(up, file, info) {
// Called when file has finished uploading
console.log('[FileUploaded] File:', file, "Info:", info);
}
}
So the loader code would be:
var uploader = $("#uploader").pluploadQueue(
{
runtimes : 'html5,html4',
url : '/admin/media/image_upload',
max_file_size : '1mb',
unique_names : true,
filters : [{title : "Image files", extensions : "jpg,gif,png"}],
init: {
FileUploaded: function(up, file, info) {
// Called when file has finished uploading
console.log('[FileUploaded] File:', file, "Info:", info);
}
}
});
I found this in the original examples - http://www.plupload.com/examples/events
0
source to share