프로필 파일 경로 변경, 허가여부 Y
This commit is contained in:
parent
165f9d7fd5
commit
237e60d1a7
@ -38,11 +38,10 @@ public class FileService {
|
||||
* 파일 업로드
|
||||
*
|
||||
* @param file
|
||||
* @param directory
|
||||
* @return
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public String uploadFile(MultipartFile file, String directory) {
|
||||
public String uploadFile(MultipartFile file) {
|
||||
try {
|
||||
// 원본 파일명
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
@ -52,7 +51,7 @@ public class FileService {
|
||||
String newFilename = UUID.randomUUID().toString() + "." + extension;
|
||||
|
||||
// 최종 저장 경로 생성 (기본경로 + 하위디렉토리 + 파일명)
|
||||
Path targetPath = Paths.get(uploadPath, directory, newFilename);
|
||||
Path targetPath = Paths.get(uploadPath, newFilename);
|
||||
// 저장될 디렉토리가 없는 경우 생성
|
||||
Files.createDirectories(targetPath.getParent());
|
||||
|
||||
@ -60,7 +59,7 @@ public class FileService {
|
||||
Files.copy(file.getInputStream(), targetPath, StandardCopyOption.REPLACE_EXISTING);
|
||||
|
||||
// 저장된 파일의 상대 경로 반환
|
||||
return directory + "/" + newFilename;
|
||||
return newFilename;
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("파일 업로드 실패: " + e.getMessage());
|
||||
|
||||
@ -43,7 +43,7 @@ public class netmemberService {
|
||||
*/
|
||||
public int register(MultipartFile memberPrf, MapDto map) {
|
||||
// 프로필 이미지 저장, 저장된 경로 가져옴
|
||||
String profilePath = fileService.uploadFile(memberPrf, "profiles");
|
||||
String profilePath = fileService.uploadFile(memberPrf);
|
||||
map.put("memberPrf", profilePath);
|
||||
|
||||
// 비밀번호 암호화 및 저장
|
||||
@ -54,7 +54,7 @@ public class netmemberService {
|
||||
map.put("memberRol", "ROLE_MEMBER");
|
||||
map.put("memberPos", 500107);
|
||||
map.put("memberTkn", "Null");
|
||||
map.put("memberPrm", "N");
|
||||
map.put("memberPrm", "Y");
|
||||
map.put("memberDel", "N");
|
||||
map.put("memberLea", "N");
|
||||
map.put("memberRdt", LocalDateTime.now());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user