chenrui
2025-05-12 f81c345f7bf058fdfe5fee6f0dfd5de0f4cb767c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.ruoyi.other.controller;
 
 
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.other.service.TempFileService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
 
 
@RestController
@RequestMapping("/file")
@AllArgsConstructor
public class TempFileController {
 
    private TempFileService tempFileService;
 
    @PostMapping("/upload")
    public AjaxResult uploadFile(MultipartFile file) {
        try {
            return AjaxResult.success(tempFileService.uploadFile(file));
        }catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
    }
 
}