简体   繁体   English

Blueimp jQuery文件上传,如何在上传时与文件一起发送额外的输入字段?

[英]Blueimp jQuery file upload, how to send extra input field along with files while upload?

Am using jquery-fileupload.js. 我正在使用jquery-fileupload.js。 I want to send another text field along with each files while uploading the files. 我想在上传文件时与每个文件一起发送另一个文本字段。 Can anyone help how or where to append the text field while uploading files? 上载文件时,任何人都可以帮助如何或在何处附加文本字段吗? Am not very clear in jquery-fileupload.js code. 在jquery-fileupload.js代码中不是很清楚。

_I have added the text field inside_

<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-upload fade">
        <!-- ... -->
       <td>
             <s:textarea name="imgDesc{%=i%}" cols="10" rows="2" theme="simple"/>
      </td>
        <!-- ... -->
    </tr>
{% } %}
</script>

Now am getting files in Struts2 action. 现在正在Struts2操作中获取文件。 I also want to get a text field while uploading the files. 我还想在上传文件时获得一个文本字段。 Please help. 请帮忙。

I just added extra field(text/ textarea) inside "" just like the code in my question. 我只是在“”中添加了额外的字段(文本/ textarea),就像我的问题中的代码一样。 I can able to get the extra in action class with any change in jquery.fileupload.js. 我可以通过在jquery.fileupload.js中进行任何更改来获得额外的操作类。 I think 我认为


formData: function (form) {
                return form.serializeArray();
            },

will handle the process. 将处理该过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM