Reputation: 5936
I am using the below code to fire an event when the upload queue has completed, however i can not seem to get it working..
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');
});
Upvotes: 3
Views: 4718
Reputation: 629
You may like another way:
Additional property 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 uploader code will 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've found this in source examples - http://www.plupload.com/examples/events
Upvotes: 1
Reputation: 15413
I don't know if this is relevant, but I use it slightly differently :
$("#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');
});
Upvotes: 4