我正在使用以下代码在上传队列完成时触发事件,但是我似乎无法使其正常工作..
有什么想法吗?
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');
});
答案 0 :(得分:3)
我不知道这是否相关,但我的用法略有不同:
$("#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');
});
答案 1 :(得分:1)
您可能喜欢另一种方式:
添加到 $(" #uploader")的附加属性.pluploadQueue():
init: {
FileUploaded: function(up, file, info) {
// Called when file has finished uploading
console.log('[FileUploaded] File:', file, "Info:", info);
}
}
所以上传代码将是:
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);
}
}
});
我在源代码示例中发现了这一点 - http://www.plupload.com/examples/events