gpt4 book ai didi

jquery - 如何获取jquery文件上传插件的文件列表?

转载 作者:行者123 更新时间:2023-12-01 02:57:07 25 4
gpt4 key购买 nike

我正在尝试通过代码触发发送操作,来自 documentation看起来像这样:

$('#fileupload').fileupload('send', {files: filesList});

但是我无法找到如何填充filesList,有什么想法吗?

这是我的 html 输入的摘录:

<input type="text" name="name"/>    
<input type="file" name="image" id="image" />

这是我尝试发送的代码

form.fileupload('send', {
url: api_urls['wishlistitem']+'?format=json',
files: $('input[name="image"]',form).files,
});

最佳答案

来自文档:

The second argument must be an object with an array (or array-like list) of File or Blob objects as files property.

创建多次上传的输入类型文件:

<input type="file" name="files[]" multiple/>

并在 jQuery 中创建数组:

var filesList = $('#fileInput')[0].files;

关于jquery - 如何获取jquery文件上传插件的文件列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18755118/

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