🐛 文件上传问题修复
This commit is contained in:
parent
d9bbc49b37
commit
53a6313fdc
@ -189,7 +189,7 @@ public class UploadController {
|
||||
String fileName = System.currentTimeMillis() + fileType;
|
||||
String savePath = file.getPath() + File.separator + fileName;
|
||||
File saveFile = new File(savePath);
|
||||
try (InputStream in = multipartFiles[i].getInputStream(); OutputStream out = Files.newOutputStream(saveFile.toPath())) {
|
||||
try (InputStream in = multipartFile.getInputStream()) {
|
||||
String md5 = DigestUtils.md5DigestAsHex(in);
|
||||
String fileUrl = forestFileService.getFileUrlByMd5(md5, tokenUser.getIdUser(), fileType);
|
||||
if (StringUtils.isNotEmpty(fileUrl)) {
|
||||
@ -197,7 +197,7 @@ public class UploadController {
|
||||
continue;
|
||||
}
|
||||
fileUrl = localPath + fileName;
|
||||
FileCopyUtils.copy(in, out);
|
||||
FileCopyUtils.copy(multipartFile.getBytes(), saveFile);
|
||||
forestFileService.insertForestFile(fileUrl, savePath, md5, tokenUser.getIdUser(), multipartFile.getSize(), fileType);
|
||||
successMap.put(orgName, localPath + fileName);
|
||||
} catch (IOException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user