
파일 다운로드
2022. 10. 31. 19:05
Spring Boot/4. 파일 업로드와 다운로드
파일 다운로드 1. 뷰 영역 변경 링크를 추가 설정 2. SQL 추가 기존과 다르게 DTO 가 아닌 map을 사용함. 이유는 단순히 파라미터 전달만을 위한 목적이기 때문. 3. 서비스 및 매퍼 추가 BoardService.java BoardFileDto selectBoardFileInformation(int idx, int boardIdx) throws Exception; BoardServiceImpl.java @Override public BoardFileDto selectBoardFileInformation(int idx, int boardIdx) throws Exception { return boardMapper.selectBoardFileInformation(idx, boardIdx); } Boa..

파일 업로드
2022. 10. 31. 18:57
Spring Boot/4. 파일 업로드와 다운로드
파일 업로드하고 파일의 정보 확인 1. 뷰 변경하기 board\src\main\resources\templates\board\boardWrite.htm . . . 1: 폼을 이용해서 데이터를 전송할 때 파일도 같이 첨부될 수 있도록 폼의 enctype 속성을 multipart/form-data 로 지정한다. 또한 폼의 전송 방식은 반드시 post로 지정해야 한다. (파일이 첨부되어 전송되도록 폼의 전송 방식을 post로 지정한다) 5: multiple 속성을 추가하면 하나의 태그에 여러 개의 파일을 첨부할 수 있다. (HTML5 이상에서) 2. 컨트롤러 변경하기 board\src\main\java\board\board\controller\BoardController.java @RequestMapping(..

파일 첨부를 위한 설정
2022. 10. 31. 15:27
Spring Boot/4. 파일 업로드와 다운로드
파일 테이블 생성하기 create table t_file( idx int(10) unsigned not null auto_increment comment '일련번호', board_idx int(10) unsigned not null comment '게시글 번호', original_file_name varchar(255) not null comment '원본 파일 이름', stored_file_path varchar(500) not null comment '파일 저장 경로', file_size int(15) unsigned not null comment '파일 크기', creator_id varchar(50) not null comment '작성자 아이디', created_datetime datetime ..