【发布时间】:2014-12-28 19:36:38
【问题描述】:
我在 blueimpe jquery 中添加名称字段多个文件上传时遇到问题。
它始终采用名称文本字段的最后分配值。如何解决这个问题?
<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload">
<td class="preview"><span class="fade"></span></td>
<td class="name"><span>{%=file.name%}</span></td>
<td class="image_name"><span><input type="text" name="image[name]"value="{%= file.name.split('/').pop().split('.').shift()%}" required/></span></td>
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
{% if (file.error) { %}
<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
{% } else if (o.files.valid && !i) { %}
<td>
</td>
<td class="start">{% if (!o.options.autoUpload) { %}
<button>
<span>{%="Upload"%}</span>
</button>
{% } %}</td>
{% } else { %}
<td colspan="2"></td>
{% } %}
<td class="cancel">{% if (!i) { %}
<button >
<span>{%="Remove"%}</span>
</button>
{% } %}</td>
</tr>
{% } %}
</script>
各种方法我都试过了。
【问题讨论】:
标签: jquery ruby-on-rails paperclip blueimp