0

I've a canvas where the user can add various shapes, texts, images etc. I need this canvas image to be stored in the server when the user hits 'save'. I used canvas.toDataURL which gives base-64 format and send this to server using JSON format.

I'm using angular to send the JSON to the server.

In case if user have created large image (more than 1MB), then the image is not saved on the server due to maxJson length error.

Tried to increase the maxJson length attribute from web config, but that's not having any effect.

Can anyone please provide any assistance over this.

Sudarshan
  • 31
  • 10
  • Any suggestions on how to increase the MaxJson limit forcefully would also help. I would also like to know any alternate methods other than sending canvas.toDataUrl's base64 format string to server. – Sudarshan Aug 03 '16 at 04:06

1 Answers1

0

Since you consider 1MB as large, it seems that you probably use the GET method to upload the JSON. If you use the POST method your problem might already be resolved and you can probably upload about 2GB on a common webserver. Hope this helps you out.

Angular has a POST shortcut: https://docs.angularjs.org/api/ng/service/$http#post

Jos
  • 419
  • 3
  • 12
  • Yes, I'm using POST. The issue might be due to maxJson length. Any suggestions on how to increase the MaxJson limit forcefully would also help. I would also like to know any alternate methods other than sending canvas.toDataUrl's base64 format string to server. – Sudarshan Aug 02 '16 at 15:26
  • See the accepted answer here for the maxJsonLength: http://stackoverflow.com/questions/1151987/can-i-set-an-unlimited-length-for-maxjsonlength-in-web-config – Jos Aug 03 '16 at 11:05
  • See the accepted answer here on how to transform base64 to a blob: http://stackoverflow.com/questions/19032406/convert-html5-canvas-into-file-to-be-uploaded – Jos Aug 03 '16 at 11:16