Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Database Spring引导多部分文件上载以及json数据_Database_Angular_Spring Boot - Fatal编程技术网

Database Spring引导多部分文件上载以及json数据

Database Spring引导多部分文件上载以及json数据,database,angular,spring-boot,Database,Angular,Spring Boot,我想使用SpringBoot多部分文件上传作为json正文的一部分来编写api,还想将img url保存在数据库中。 如下所示的请求: ------WebKitFormBoundarynBsAcX7rJhOGsmfY Content-Disposition: form-data; name="fdata"; filename="blob" Content-Type: application/json {"firstname":"saurabh","lastname":"mishra","mob

我想使用SpringBoot多部分文件上传作为json正文的一部分来编写api,还想将img url保存在数据库中。 如下所示的请求:

------WebKitFormBoundarynBsAcX7rJhOGsmfY
Content-Disposition: form-data; name="fdata"; filename="blob"
Content-Type: application/json

{"firstname":"saurabh","lastname":"mishra","mobile":"943847557"}
------WebKitFormBoundarynBsAcX7rJhOGsmfY
Content-Disposition: form-data; name="files"; filename="download.jpg"
Content-Type: image/jpeg


------WebKitFormBoundarynBsAcX7rJhOGsmfY--

请帮我找到解决办法。

我用这种方法解决这个问题

我的API方法

我的FileWithObject DTO

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({“文件”、“文件”、“数据”})
公共类FileWithObject{
@JsonProperty(“文件”)
私有多部分文件;
@JsonProperty(“文件”)
私有多部分文件[]文件;
@JsonRawValue
@JsonProperty(“数据”)
私有T数据;
//getter/setter和其他。。。
}
注意:-对于数据参数,可以使用singleFileUploadWithObject方法中的映射过程 希望对你和其他人有帮助

1)在发布时使用{}格式化程序格式化代码。2) 包括你自己解决问题的尝试,以及你受到打击的地方
@RequestMapping(value="/filestore/{bucket-uuid}/appsport.com/singleFileUploadWithObject/{folder}",
        method = RequestMethod.POST)
@ResponseBody
public String singleFileUploadWithObject(
        @PathVariable(name="bucket-uuid", required = true) String bucketUUId,
        @PathVariable(name="folder", required = false) String folder,
        FileWithObject rawData) {
    return pingResponse;
}
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({ "file", "files", "data" })
public class FileWithObject<T> {

    @JsonProperty("file")
    private MultipartFile file;
    @JsonProperty("files")
    private MultipartFile[] files;
    @JsonRawValue
    @JsonProperty("data")
    private T data;
    // getter/setter and other...
}