gpt4 book ai didi

javascript - 使用 ajax 发送输入文件数据

转载 作者:可可西里 更新时间:2023-11-01 13:24:14 25 4
gpt4 key购买 nike

<分区>

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.' );
}
});

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com