标签:360云盘 服务 有一个 请求 要求 eth div upload span
@MultipartConfig @WebServlet("/uploads") public class Upload extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); Part part = req.getPart("file"); String realPath = getServletContext().getRealPath("fileUpload"); System.out.println(realPath); String header = part.getHeader("Content-Disposition"); String[] array = header.split(";"); String filename = array[array.length - 1]; String[] arr = filename.split("="); String filerealname = arr[arr.length - 1]; String file = filerealname.substring(1, filerealname.length() - 1); System.out.println(file); System.out.println(realPath + "\\" + file); part.write(realPath + "\\" + file); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } }
标签:360云盘 服务 有一个 请求 要求 eth div upload span
原文地址:https://www.cnblogs.com/nangongyibin/p/10225922.html