Update file saving code
This commit is contained in:
@@ -2,6 +2,7 @@ package com.mattrixwv.raidbuilder.service;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
@@ -41,7 +42,8 @@ public class GameClassService{
|
||||
Path filePath = Paths.get(uploadFileDirectory + "/gameClassIcons").resolve(fileName);
|
||||
|
||||
try{
|
||||
file.transferTo(filePath);
|
||||
//file.transferTo(filePath);
|
||||
Files.copy(file.getInputStream(), filePath);
|
||||
gameClass.setGameClassIcon(fileName);
|
||||
}
|
||||
catch(Exception error){
|
||||
@@ -49,6 +51,7 @@ public class GameClassService{
|
||||
throw new RuntimeException("Error uploading file: " + error.getMessage(), error);
|
||||
}
|
||||
}
|
||||
|
||||
return gameClassRepository.save(gameClass);
|
||||
}
|
||||
|
||||
@@ -69,7 +72,8 @@ public class GameClassService{
|
||||
String fileName = UUID.randomUUID().toString() + "--" + file.getOriginalFilename();
|
||||
Path filePath = Paths.get(uploadFileDirectory + "/gameClassIcons").resolve(fileName);
|
||||
try{
|
||||
file.transferTo(filePath);
|
||||
//file.transferTo(filePath);
|
||||
Files.copy(file.getInputStream(), filePath);
|
||||
gameClass.setGameClassIcon(fileName);
|
||||
}
|
||||
catch(Exception error){
|
||||
|
||||
Reference in New Issue
Block a user