FINEUPLOAD将ID作为参数传递 [英] FINEUPLOAD pass the ID as parameter
问题描述
我有这个divs
<div id="thumbnail-uploader_1" class="thumbnail-uploader">
<div id="thumbnail-uploader_2" class="thumbnail-uploader">
和这个Jquery调用
and this Jquery call
$('.thumbnail-uploader').fineUploader({
request: {
endpoint: '/core/ajax/add_avatar.php',
params: {
one: function() {
return this.id;
}
}
},
multiple: false,
validation: {
allowedExtensions: ['jpeg', 'jpg', 'gif', 'png'],
sizeLimit: 551200 // 50 kB = 50 * 1024 bytes
},
text: {
uploadButton: 'Klikněte nebo sem přetáhněte soubor'
}
}).on('complete', function(event, id, fileName, responseJSON) {
if (responseJSON.success) {
$(this).append('<img src="/uploads/categories/' + fileName + '" alt="' + fileName + '">');
$('.qq-upload-list').fadeOut(2500);
}
});
我要做的就是传递使用的上载器的ID.但是通过此调用,当我尝试在作为处理程序的"add_avatar.php"中使用参数"one"时,得到了未定义的值.我在那边使用全局数组REQUEST来检查值是否通过.但未定义.
all i want to do is to pass the ID of the used uploader. but with this call, i got undefined value of the parameter "one" when i try to use it in "add_avatar.php" which is handler. i use the global array REQUEST over there to check if the value pass. but its undefined.
有人知道如何在我的PHP脚本中传递ID吗?我将在那里有更多该上传器的实例,因此我必须检查更改头像时的记录.
does anyone have some idea how to pass the ID in my php script? i will have more instances of this uploader there so i have to check for which record im changing the avatar.
推荐答案
由于您使用的是jQuery,也许这就是您想要的.
Since you are using jQuery, maybe this is what you are looking for.
return $(this).attr('id');
这篇关于FINEUPLOAD将ID作为参数传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!