张涛 1 rok temu
rodzic
commit
795d3aaf58

+ 8
- 5
src/main/java/com/lyg/tools/controller/UploadController.java Wyświetl plik

@@ -34,12 +34,14 @@ public class UploadController {
34 34
      * @throws Exception
35 35
      */
36 36
     @PostMapping("/upload/cms")
37
-    public ResponseBean uploadAdmin(@RequestParam(value = "file") MultipartFile file) throws Exception {
37
+    public ResponseBean uploadAdmin(@RequestParam(value = "file") MultipartFile file,
38
+                                    @PathVariable(value = "appid") String appid
39
+    ) throws Exception {
38 40
         String fileType = getFileType(file);
39 41
 
40 42
         Map<String, Object> res = new HashMap<>();
41 43
         String fileName = file.getOriginalFilename();
42
-        String path = fileUtil.saveFile(file, "cms");
44
+        String path = fileUtil.saveFile(file, appid);
43 45
         res.put("attachUrl", path);
44 46
         res.put("attachName", fileName);
45 47
         res.put("fileType", fileType);
@@ -54,9 +56,10 @@ public class UploadController {
54 56
      * @throws Exception
55 57
      */
56 58
     @PostMapping("/upload/base64/{appid}")
57
-    public ResponseBean uploadBase64(@PathVariable(value = "appid") String appid,
58
-                                     @RequestParam(value = "base64") String base64,
59
-                                     @RequestParam(value = "fileName", defaultValue = "unknown.jpg") String fileName
59
+    public ResponseBean uploadBase64(
60
+            @PathVariable(value = "appid") String appid,
61
+            @RequestParam(value = "base64") String base64,
62
+            @RequestParam(value = "fileName", defaultValue = "unknown.jpg") String fileName
60 63
     ) throws Exception {
61 64
 
62 65
         Map<String, Object> res = new HashMap<>();