| | |
| | | if (!uploadDir.isDirectory()) { |
| | | uploadDir.mkdir(); |
| | | } |
| | | log.info("uploadDto:" + uploadDto.getBase64Str()); |
| | | BASE64Decoder decoder = new BASE64Decoder(); |
| | | byte[] bytes = new byte[0]; |
| | | try { |
| | |
| | | if (bytes.length > maxSize) { |
| | | return AjaxResult.buildFailInstance("上传文件大小超过限制"); |
| | | } |
| | | String newFileName = UUIDUtil.getRandomID() + UUIDUtil.getRandomID() + "." +".jpg"; |
| | | String newFileName = UUIDUtil.getRandomID() + UUIDUtil.getRandomID() + ".png"; |
| | | File uploadedFile = new File(savePath, newFileName); |
| | | try { |
| | | FileCopyUtils.copy(bytes, uploadedFile); |
| | |
| | | log.info("上传一个文件:" + newFileName); |
| | | log.info("访问路径:" + visitPath); |
| | | |
| | | AjaxResult result = new AjaxResult(); |
| | | AjaxResult result = AjaxResult.buildSuccessInstance("上传成功"); |
| | | result.putInMap("path", visitPath); |
| | | result.putInMap("fileName", newFileName); |
| | | return result; |