(MultipartFile multipartFile)
| 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) { |
no test coverage detected