<form class="imagegen_file" enctype="multipart/form-data" action="/image_maker/file">
<input class="file" name="image_0" type="file">
<input class="file" name="image_1" type="file">
<input class="file" name="image_2" type="file">
<input class="file" name="image_3" type="file">
<input .....
</form>
<a onclick="return image_gen_file();">upload</a>
<script type="text/javascript">
function image_gen_file(){
var data = new FormData();
jQuery.each($('.file')[0].files, function(i, file) {
data.append('image_'+i, file);
});
$.ajax({
url: baseurl + "/image_maker/file",
data: data,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function(data){
alert(data);
}
});
}</script>
上述代码文件上传的人仅适用于第一个输入(“image_0”)我想让它适用于所有其他人我该怎么做?