我正在尝试开发一种微服务来接收base64编码的数据。当我尝试通过6 MB的数据发送数据时,出现以下错误-
多部分请求的参数化数据(不包括上传的文件)超出了在关联的连接器上设置的maxPostSize限制
@RequestMapping(value = "/base64/upload", method = RequestMethod.POST,
consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public String base64(@RequestParam("file") String file) {
System.out.println(file);
return "done";
}
Run Code Online (Sandbox Code Playgroud)
我的应用程序属性:
#http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#common-application-properties
#search multipart
spring.http.multipart.max-file-size=200MB
spring.http.multipart.max-request-size=100MB
Run Code Online (Sandbox Code Playgroud)
因此,我阅读了其他文章,并将以上REST API更改为以下内容-
@RequestMapping(value = "/base64/uploadFile", method = RequestMethod.POST,
consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public String base64(@RequestParam("file") MultipartFile file) {
if (file.isEmpty()) {
return "redirect:uploadStatus";
}else {
return "redirect:success";
}
}
Run Code Online (Sandbox Code Playgroud)
现在如何从前端应用程序(反应应用程序)将转换后的base64数据作为文件上传?
function getBase64(file) {
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function () {
console.log(reader.result); // file content is converted to base64
makeRequest(reader.result,file); …
Run Code Online (Sandbox Code Playgroud) 我正在尝试为删除编写存储过程。但是为了提高性能,我们已将delete sql查询更改为使用IN
操作。我要编写接受逗号分隔ID的过程。
我尝试编写一个接受单个条目ID的过程。步骤如下。
CREATE PROCEDURE DeleteListEntry
@entryid int
AS
DELETE FROM LIST_ITEMS
WHERE ENTRY_ID = @entryid;
go
Run Code Online (Sandbox Code Playgroud)
我想知道如何将上述过程转换为接受批量输入。它的SQL查询如下-
DELETE FROM LIST_ITEMS WHERE ENTRY_ID IN (id1, id2, id2, ... );
Run Code Online (Sandbox Code Playgroud)