1、yml配置
下面的服务器根据自己所用的进行调整即可
upload: file: # 这是linux服务器的上传路径 # location: file:/mnt/www/pp/test_ai/image #这是windows服务器的上传路径 location: file:d://image/ #这是访问的虚拟路径 path: /temp-image/** fileServer: #这是访问图片的服务 url: http://localhost:9099/test_api
2、上传controller
此方法中ObjectResponse是本人自定义的返回类,大家可以根据自己的来进行编写。
@RequestMapping({"/file"}) @RestController @CrossOrigin(origins = {"*"}, maxAge = 3600) /* loaded from: CarouseImageController.class */ public class FileUploadController { @Value("${upload.file.location}") private String fileLocation; @Value("${upload.file.path}") private String filePath; @Value("${fileServer.url}") private String fileServer; @PostMapping({"/importPicture"}) @ResponseBody @CrossOrigin(origins = {"*"}) public ObjectResponse importPicture(@Requ