gpt4 book ai didi

java - 多文件上传jsp & servlet

转载 作者:行者123 更新时间:2023-12-02 10:58:36 26 4
gpt4 key购买 nike

HTML 代码:

<form action="test" method="post">
Select files: <input type="file" id="myfiles" name="myfiles" multiple>
<input type="submit">
</form>

Servlet 代码:

@WebServlet("/test")
@MultipartConfig
public class test extends HttpServlet {
List < FileItem > multiparts = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
}

错误:

httpservletrequest cannot be converted to requestcontext

最佳答案

提及enctype在你的<form>

<form action="test" method="post" enctype="multipart/form-data">

关于java - 多文件上传jsp & servlet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51524725/

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