gpt4 book ai didi

javascript - 通过 ajax post (jQuery) 发送输入类型 ="file"表单数据

转载 作者:行者123 更新时间:2023-11-29 18:27:52 25 4
gpt4 key购买 nike

我想从这样的输入发送帖子数据:

<input type="file" name="userFile" id="userFile"/>

?

我需要使用 $.post 通过 ajax 将其发送到指定文件。

我该怎么做?

最佳答案

如果没有 HTML5,这是不可能的,如果没有针对不支持它的浏览器的解决方法,html5 解决方案将无法在所有浏览器中运行。

解决这个问题的最跨浏览器的方法是不使用 ajax 而是发布到隐藏的 iframe。

或者使用插件,例如 uploadify .

大多数(如果不是全部)实现此功能的 jQuery 插件在不支持 html5 方法时使用 flash 或隐藏的 iframe。

关于javascript - 通过 ajax post (jQuery) 发送输入类型 ="file"表单数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11265461/

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