How to work with Multipartfile in Spring Boot?

Asked

Viewed 82 times

0

I’m still in the process of implementing upload images, see the code below;

@PostMapping
        public String upload(@RequestParam("files[]") MultipartFile[] files) {
        System.out.println("files >>>>>>>>>>>>>>>>>>>>>>> "  + files.length);
        return "ok";

    }

I am using the STS of Spring Boot, after selecting the image using Postman the result was 0 instead of having returned 1 as you can see below in the STS console;

inserir a descrição da imagem aqui

How do I get returns 1 ?

  • Assuming the input is "files", try to replace the @RequestParam("files[]") for @RequestParam("files")

  • unfortunately that didn’t work.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.