score:1

Accepted answer

The error was that

strFile.replace(' ', '+'); 

needed to be

strFile = strFile.replace(' ', '+');

This is needed as posting the string will convert '+' characters to spaces.

The code works well now, I'm able to save Highchart charts in png files on the server side

score:1

Try changing this line:

byte[] decoded = Base64.decodeBase64(strFile);

If you are sending the full image as request:

   boolean isMultipart = ServletFileUpload.isMultipartContent(request);
   System.out.println("request: "+request);
   if (!isMultipart) {
          System.out.println("File Not Uploaded");
   } else {
          FileItemFactory factory = new DiskFileItemFactory();
          ServletFileUpload upload = new ServletFileUpload(factory);
          List items = null;

          try {
               items = upload.parseRequest(request);
               System.out.println("items: "+items);
          } catch (FileUploadException e) {
               e.printStackTrace();
          }
   }

Related Query

More Query from same tag