2014-03-25 229 views
1

您可以添加自定义按钮来扩展上传器的功能。 我需要的是允许用户在图片上传后将文本输入到表单中。添加自定义按钮

有没有关于此的任何文档? 的目标是添加一个可以获取图像UUID的附加按钮,并打开一个文本区域以输入文本以发回服务器。 谢谢。

回答

1

我需要的是允许用户在图片上传后输入文本到表单中的功能。

客户端知道已经“成功”上传的图片是如果服务器返回正确的响应和onComplete事件被称为唯一的办法。这里面处理程序可以运行你想,包括得到一个成功上传项目的UUID任意代码:

// ... 
onComplete: function(id, name, json, xhr) { 
    var uuid = this.getUuid(id); 
    // or if using jQuery 
    // var uuid = $(this).fineUploader('getUuid', id); 

    if (json.success === true) { 
     // then you will render your text area, and then intercept its form submit to 
     // send the POST request data to the server. Left as an exercise to the user. 
    } 



} 
// ... 
+0

OK尝试添加该代码,但我得到的精细上传jQuery的事件处理程序下面的错误 陷入错误:Object [object Object]没有方法'getUuid' –

+0

你从未指定过使用jQuery插件版本。将'this.getUuid(id)'改为'$(this).fineUploader('getUuid',id);' –