I have a page where users can paint on it. This area uses HTML5 canvas.

Now I want put an button for users to send that image to the server.

I know I can do this by ajax in client side and web-method in server side.

How could I combine this? How could I create a web-method in SharePoint and something like this?

1 Answer 1


First you should serialize your Canvas to a Data Url using: canvas.toDataURL();

By doing so, you get the Image as a dataURL, which contains the base 64 Encoded Version of the File (usually in PNG Format). The Data is located after the first comma. Details here.

You can then upload this file using either CSOM or REST.

See this article for uploading

  • hi. i cant achieve this. my sharepoint ver is 2010. i can encode image to 64bit but cant upload it by REST or CSOM
    – Cawboy
    May 31, 2016 at 9:51
  • CSOM also works with SP 2010. What exactly does the error message say? Jun 2, 2016 at 12:21
  • I do not have an error. my requirement is a Walkthrough to do it. an example or way to show me how could save an image from client to share-point server 2010
    – Cawboy
    Jun 5, 2016 at 10:52
  • So you are asking Harry to do your job? Jun 17, 2016 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.