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, String type) {
|
try {
|
return AjaxResult.success(tempFileService.uploadFile(file, type));
|
} catch (Exception e) {
|
return AjaxResult.error(e.getMessage());
|
}
|
}
|
|
}
|