Good morning, my problem is as follows, I am loading multiple files from a web app, the flow is correct, only I have not managed to rename the files to a predefined name standard before saving them in the destination directory. .
public void guardarMultiplesArchivos(List<MultipartFile> files, String directorioRoot, BigDecimal subDirectorio) throws IOException {
for (MultipartFile file : files) {
guardarArchivo(file,directorioRoot, subDirectorio);
}
}
private void guardarArchivo(MultipartFile file, String directorioRoot, BigDecimal subDirectorio) throws IOException {
if (file.isEmpty()) {
return;
}
if (!isValidoContentType(file.getContentType())) {
return;
}
byte[] bytes = file.getBytes();
Path path = Paths.get(directorioRoot+File.separator+subDirectorio+File.separator+file.getOriginalFilename());
Files.write(path, bytes);
}
Thank you ...