I'm not sure about what your question is, but indeed, you can use a combination of Ajax + PHP to upload your image.
For an example of the process, check this question, where a specific case of a canvas is discussed. I think your SVG conversion could work in a similar way.
PS: For some reason, I couldn't load your Fiddle.
So both Ajax & PHP are written on the front end to send the image to my server/database (ruby on rails). Is that correct?
img) to the server (more info here).
The server (a PHP, ASPX or Ruby script [among others]) gets the POSTed data and saves the picture on disk (some info here).
If you can use PHP (in the server) for the specific process of saving the image, you can use the question I linked before as a guide.