MCPcopy Create free account
hub / github.com/Hello-hao/Tbed / changeFile_new

Method changeFile_new

src/main/java/cn/hellohao/utils/SetFiles.java:53–66  ·  view source on GitHub ↗
(MultipartFile multipartFile)

Source from the content-addressed store, hash-verified

51
52 // 转换文件方法
53 public static File changeFile_new(MultipartFile multipartFile) {
54 String fileName = multipartFile.getOriginalFilename();//getOriginalFilename
55 String prefix = fileName.substring(fileName.lastIndexOf("."));
56 // todo 修改临时文件文件名
57 File file = null;
58 try {
59 String new_FileName = System.getProperty("java.io.tmpdir")+"hellohao_tmp_upload"+File.separator+fileName;
60 file = new File(new_FileName);
61 FileUtils.copyInputStreamToFile(multipartFile.getInputStream(), file);
62 } catch (IOException e) {
63 logger.error("SetFiles.changeFile_new", e);
64 }
65 return file;
66 }
67
68 //文件大小单位转换
69 public static String readableFileSize(long fileS) {

Callers 4

upimgMethod · 0.95
imgUploadMethod · 0.95
imgUploadForCopyMethod · 0.95
uploadImgMethod · 0.95

Calls 3

getOriginalFilenameMethod · 0.80
errorMethod · 0.80
getInputStreamMethod · 0.45

Tested by

no test coverage detected