0

I want to send a canvas image object to the server using ajax. After creating the canvas image

 var dataURL = canvas.toDataURL();

$.ajax({
    type: "POST",
    url: "uploadProfPic",
    data: { userId: user, imgBase64: dataURL }
})

in the controller I tried like

@RequestMapping(value = "/uploadProfPic",method = RequestMethod.POST)
public @ResponseBody uploadProfPic(@RequestParam(value="imageBase64", defaultValue="")String imageBase64, String userId){

    return userId;
}

In @RequestParam what will i write to get the canvas object?

Subho
  • 921
  • 5
  • 25
  • 48

1 Answers1

0
@RequestParam String imgBase64

As you are transmitting the data as a string.

realsim
  • 1,386
  • 3
  • 13
  • 25