HTML标记:
<input id="fileSelect" type="file" id="file" name="files[]" multiple="multiple" accept="image/*" />
我正在使用PHP上传多个文件。 我想将上传文件的数组制作并使用ajax发送到服务器。 如何制作多个所选文件的数组?
JavaScript:
jQuery.ajax({
url: 'insertfiles.php',
type: "POST",
data: {
file: // array of selected files.
},
success: function(data){
},
error: function(data){
alert( 'Sorry.' );
}
});
FormData
,请参见此处。 - adeneo