Code: Select all
Some name -- some other informationCode: Select all
file.setFileName(file.getFile().getOriginalFilename());Ich frage mich, ob es eine programmgesteuerte Lösung gibt, um den ursprünglichen Dateinamen in einer solchen Situation zu überprüfen.
Aus Gründen der Transparenz finden Sie hier den Code zum Hochladen der Datei:
Code: Select all
public void saveOpcertCeuFile(OpcertCeuFileUpload file) {
UmdContact user = secUtilService.getActiveUser();
String username = user.getEmail();
Date now = new Date();
file.setCreatedTs(now);
file.setLastUpdatedTs(now);
file.setCreatedBy(username);
file.setLastUpdatedBy(username);
file.setFileName(file.getFile().getOriginalFilename());
file.setIsApproved(Boolean.FALSE);
file.setIsDeleted(Boolean.FALSE);
try {
file.setByteContents(file.getFile().getBytes());
} catch (Exception ex) {
log.info(ex);
throw new RuntimeException(ex);
}
dao.insertOpcertCeuFileUpload(file);
Path path = this.getOptcertCeuFilePath(file);
String configF = envService.getServerUrl();
file.setFilePath(String.valueOf(path));
dao.updateOpcertCeuFilePath(file);
try {
File file1 = path.toFile();
file1.getParentFile().mkdirs();
Files.write(path, file.getByteContents(), StandardOpenOption.CREATE_NEW);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
Mobile version