So Im writing my own client in Java and Im running into an issue
Im trying to upload my image but I keep getting
{"status": "error", "errormessage": "no json"}
Im pretty certain it might be the encoding of my image. Attached is the file with the full encoding in base64. what Im not so sure about is do I encode it into a String or byte array?
block of code thats doing the image encoding:
BufferedImage sourceimage = ImageIO.read(new File(path));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(sourceimage, "png", baos);
byte[] bytes = baos.toByteArray();
String s = Base64.getEncoder().encodeToString(bytes);
Incase youre wondering this is my header
HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setRequestMethod("POST");
if (getSession() != null) {
//header
con.setRequestProperty("Content-Type","multipart/form-data ; boundary="+boundary.toString());
}
con.setRequestProperty("Accept", "application/json");
con.setDoOutput(true);