简体   繁体   中英

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

Am using 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.

_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. 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. I can able to get the extra in action class with any change in jquery.fileupload.js. I think


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

will handle the process.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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