package com.tanpu.community.controller; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.resp.FileUploadResp;
import com.tanpu.community.manager.FileManager; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @RestController @Slf4j @RequestMapping(value = "/api/file") public class FileController { @Autowired private FileManager fileManager; @PostMapping("/uploadFile") @ResponseBody
public CommonResp<FileUploadResp> uploadToRemote(@RequestParam(value = "file") MultipartFile file) {
return CommonResp.success(fileManager.uploadFile(file)); } }