Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plupload - Event not firing

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');
});
like image 828
Lee Avatar asked Dec 30 '25 01:12

Lee


2 Answers

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');
});
like image 53
jbl Avatar answered Dec 31 '25 16:12

jbl


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

like image 36
Dmitrii Malyshev Avatar answered Dec 31 '25 15:12

Dmitrii Malyshev