Код: Выделить всё
@Override
public String store(MultipartFile file) {
String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
String fileName = UUID.randomUUID().toString().replaceAll("-", "") + ext;
File filePath = new File(BASEPATH, fileName);
try (FileOutputStream out = new FileOutputStream(fileName)) {
FileCopyUtils.copy(file.getInputStream(), out);
return fileName;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
Подробнее здесь: https://stackoverflow.com/questions/784 ... ying-in-fr
Мобильная версия