0

I have one condition where I need a multipart file as parameter and another request body in which some details related to file will be there, so is it possible for me to do that ?

@RequestParam(value = "name", required = false) String name,
            @RequestParam("file") MultipartFile file, @RequestBody CandidteEmailDTO dto
Vipul Jain
  • 1,395
  • 1
  • 14
  • 28
  • are fixed this issue Vipul? I have same issue can you please give me suggition if you fixed.Thanks in advance – Sairam Apr 25 '17 at 15:54
  • No Sairam, it wasn't resolved, but I changed the criteria, now I am taking file in candidateEmailDTO only, and I am taking that in byte array format, SO i think that can help you also – Vipul Jain Apr 26 '17 at 05:15

2 Answers2

0

yes, it is possible to do. You should just ensure that you don't forget to declare enctype = "multipart/form-data", in your form tag.

  • But how I will pass a request here? because when I see in postman I can either send form data in which we can have file or we can send 'raw' object in the form of json, we can't send both of them together. – Vipul Jain Apr 06 '17 at 07:05
0

Maybe you can take a look at this answer. I think that you need to change the @RequestParam to @FormDataParam

Community
  • 1
  • 1