mczal mczal - 28 days ago 8
AngularJS Question

Post method a file and string request to spring rest controller that receive byte[] and Strings using angular?

How to send a post method that contains a file and another string request parameter to a spring rest controller using angular ?

The server controller parameter receives an array of byte file and other String request which is encapsulated in one entity. I've been working on this for 2 days with no suitable ways for did this.

Here is the image for controller, encapsulated request entity, post method using angular resources, and error from server:

enter image description here

Answer

Already done. In javascript i'm converting my file into base64 first, and then convert it into a byte[] in the spring controller using javax.xml.bind.DatatypeConverter.parseBase64Binary().

Comments