728x90
하나의 formData에
텍스트와 이미지 파일을 함께 보내서 처리하고 싶었다.
그러려면 다음과 같이 처리하자
front에서 처리(vue.js)
const formData = new FormData();
formData.append('file', this.$refs.fileUpload.files[0]);
formData.append('param', JSON.stringify(회원가입파라미터));
@RequestParam은
multipart를 맡는다
@RequestPart는
JSON을 맡는다
중요한건 key값 설정
두개 이상 올 경우 구분하기 위해
key 매핑을 해줘야함
'Spring' 카테고리의 다른 글
Spring boot) vue + springboot 에서 router 사용하기 (0) | 2024.01.28 |
---|---|
spring boot) vue + spring boot websocket 웹소켓 proxy error (0) | 2024.01.28 |
mybatis) attempted to return null 에러 (0) | 2024.01.08 |
SpringBoot JPA - h2 DB 접속하는 법(drop table if exists 테이블명 cascade) (0) | 2023.11.19 |
스프링 암호화 (0) | 2022.03.18 |