0

I'm trying to post multipartfile with postman, but comes null

I have the following method in my controller. Controller accepts null instead of multipartfile

@PostMapping("/upload_bpmn_with_body")
    fun uploadBPMN(@RequestBody fileBPMN: MultipartFile): CProcess {
        return serviceProcesses.save(serviceBPMN.parseBPMN(fileBPMN))
    }

I also added the following lines for multipartfile to the application.yml file, but this did not solve the problem

spring:
  datasource:
    url: jdbc:postgresql://localhost/workflow
    username: workflow
    password: workflow
  jpa:
    hibernate:
      ddl-auto: update
    show-sql: true

  servlet:
    multipart:
      enabled: true
cph
  • 1
  • There are some articles and answers here on SO regarding this. Please try to replace `@RequestBody` with `@RequestParam`. It should look something like this: `fun uploadBPMN(@RequestParam("file") fileBPMN: MultipartFile`) – Roar S. Apr 09 '23 at 14:51
  • Tried that too, but it didn't work. Now I also changed the sending settings in postman and everything worked, thanks – cph Apr 09 '23 at 15:12

0 Answers0