Commit c029c27762695492900d25934d0cb3380cf04e07
1 parent
20c3076e
Exists in
master
文件上传代码提交
Showing
2 changed files
with
16 additions
and
1 deletions
Show diff stats
cloud/fIle-center/src/main/java/com/sincere/file/control/FileControl.java
| ... | ... | @@ -52,9 +52,18 @@ public class FileControl { |
| 52 | 52 | resultFile.setHref(""); |
| 53 | 53 | fileList.add(resultFile); |
| 54 | 54 | return Result.genSuccessResult(fileList); |
| 55 | - | |
| 56 | 55 | } |
| 57 | 56 | |
| 57 | + @PostMapping("fileUpload2") | |
| 58 | + @ApiOperation("上传文件(重复文件会新增1)") | |
| 59 | + public Result fileUpload2(@RequestParam("imgFile") MultipartFile file, HttpServletRequest request) throws Exception { | |
| 60 | + | |
| 61 | + String ossPath = request.getHeader("ossPath");//oss的二级目录 | |
| 62 | + | |
| 63 | + FileInfo fileInfo = fileService.upload(file, ossPath); | |
| 64 | + | |
| 65 | + return Result.genSuccess(fileInfo.getUrl()); | |
| 66 | + } | |
| 58 | 67 | |
| 59 | 68 | @PostMapping("fileUpload1") |
| 60 | 69 | @ApiOperation("上传文件") | ... | ... |
cloud/fIle-center/src/main/java/com/sincere/file/model/result/Result.java