多部分发送带有自定义表单数据名称的请求

问题描述

我遇到的问题是服务器期望使用filename而不是name的multipart / formdata来允许文件上传。 我的问题是如何发送此POST请求。

我需要的示例:

----WebKitFormBoundaryTb3R7liAkDMDxIaB
Content-disposition: form-data; filename="foobar.mp4"

file
------WebKitFormBoundaryTb3R7liAkDMDxIaB--

浏览器(Chrome,IE,Edge,Firefox)发送的请求:

----WebKitFormBoundaryTb3R7liAkDMDxIaB
Content-disposition: form-data; name="foobar.mp4"

file
------WebKitFormBoundaryTb3R7liAkDMDxIaB--

HTML:

<form action="https://www.example.com/upload" method="POST" enctype="multipart/form-data">
      <input type="hidden" name="foobar&#46;mp4" value="file" />
      <input type="submit" value="Submit request" />
    </form>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)