idea中httpclient插件上传文件
引用自:
Exploring the HTTP request syntax | IntelliJ IDEA
其中比较容易迷惑的是filename字段
Content-Disposition: form-data; name="first"; filename="input.txt"
该字段本质就是head:Content-Disposition中String中的一个kv字符串,只不过servlet3.1开始对其进行了特殊处理
并且该字符串(因为本质上连字段都算不上)也并不是必须的,可以不写
/**
* Gets the file name specified by the client
*
* @return the submitted file name
*
* @since Servlet 3.1
*/
public String getSubmittedFileName();
详细程序可参考:
java服务端接收文件_yilu_beiyu的博客-CSDN博客
参考资料: