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