From 29fff07c92c555916287614788e56f68fab7c844 Mon Sep 17 00:00:00 2001 From: daniel LEE Date: Thu, 2 Nov 2023 17:28:57 +0900 Subject: [PATCH] =?UTF-8?q?form-data=20=ED=98=95=EC=8B=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UserProfileController.java | 7 +-- src/main/webapp/WEB-INF/views/add.jsp | 46 +++++++++++++------ 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/example/demo/controller/UserProfileController.java b/src/main/java/com/example/demo/controller/UserProfileController.java index 2a43314..3497a02 100644 --- a/src/main/java/com/example/demo/controller/UserProfileController.java +++ b/src/main/java/com/example/demo/controller/UserProfileController.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @@ -48,9 +49,9 @@ public class UserProfileController { @PostMapping("/user/{id}") // public HashMap putUserProfile(@PathVariable String id, @RequestParam String name, // public void putUserProfile(@PathVariable String id, @RequestParam String name, - public List postUserProfile(@PathVariable String id, @RequestParam String name, - @RequestParam String phone, @RequestParam String address, - @RequestParam MultipartFile upfile) { + public List postUserProfile(@PathVariable("id") String id, @RequestParam("name") String name, + @RequestParam("phone") String phone, @RequestParam("address") String address, + @RequestPart MultipartFile upfile) { String uuid = UUID.randomUUID().toString(); String fileName = upfile.getOriginalFilename(); diff --git a/src/main/webapp/WEB-INF/views/add.jsp b/src/main/webapp/WEB-INF/views/add.jsp index 5f0c43b..d5ce8be 100644 --- a/src/main/webapp/WEB-INF/views/add.jsp +++ b/src/main/webapp/WEB-INF/views/add.jsp @@ -10,21 +10,37 @@