gpt4 book ai didi

java - 在 Controller 中读取 requestparam 时出现问题

转载 作者:行者123 更新时间:2023-12-01 19:47:30 25 4
gpt4 key购买 nike

请求参数显示在网络中,但第二个参数(fileId)在 Controller 中接收为空。请求返回 400 错误请求。

@PostMapping(path = "/uploadFile")
public ResponseEntity<ServiceResponse> upload(
@RequestParam(value = "id") Long userId,
@RequestParam(value = "fileId") Long fileId,
@RequestPart(value = "file") MultipartFile... file) {

//
return ResponseEntity.ok(serviceResponse);
}

请求URL:(文件在body中发送:formData) http://localhost:8080/api/upload?id=9999&fileId=101

最佳答案

那么,您可以至少显示您的请求或 URL 吗?

关于java - 在 Controller 中读取 requestparam 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59111767/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com