This commit is contained in:
2023-07-07 12:32:28 +08:00
parent 0f053f6613
commit 59e3373b81
3 changed files with 15 additions and 6 deletions

View File

@@ -39,7 +39,7 @@ public class UploadHandleServlet extends HttpServlet {
//得到上传文件的保存目录将上传的文件存放于WEB-INF目录下不允许外界直接访问保证上传文件的安全
String savePath = this.getServletContext().getRealPath(File.separator+"WEB-INF"+File.separator+"upload");
savePath= this.getServletContext().getRealPath(File.separator+"WEB-INF"+File.separator+"upload").replace("\\out\\artifacts\\hellogithub_war_exploded\\WEB-INF\\upload","\\web\\uploadFile");
savePath= this.getServletContext().getRealPath(File.separator+"WEB-INF"+File.separator+"upload").replace("\\out\\artifacts\\helloGithub_war_exploded\\WEB-INF\\upload","\\web\\uploadFile");
System.out.println(savePath);
// savePath="D:\\Java\\helloG\\hellogithub\\web\\uploadFile";
// String savePath="E:\\Desktop\\out";

View File

@@ -3,11 +3,11 @@ package com.hellogithub.servlet;
import com.alibaba.fastjson.JSONObject;
import com.hellogithub.entity.userEntity;
import com.hellogithub.service.UserService;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;