JS:How to send multiple files using FormData(jQuery Ajax)
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In my form multiple file uploads are there,using FormData only one file is uploading ,though I'm selecting more than one file to upload,following is the code HTML JS var ajaxData = new FormData(); ajaxData.append( 'action','uploadImages'); jQuery.each($("input[name^='photo']")[0].files, function(i, file) { ajaxData.append('photo['+i+']', file); }); $.ajax({ url: URL, data: ajaxData, cache: false, contentType: false, processData: false, type: 'POST', dataType:'json', success: function(data) { if (data.status == 'success') { location.reload();