1

I've generated a base64 data of an image and fed it into the src attribute of the <img/> tag so now the image appears. But now next task is to upload the image file from the <img/> tag to the server. But since I've the base 64 of the image I don't know how to upload it to the server.

Please guide.

Temp O'rary
  • 5,366
  • 13
  • 49
  • 109
  • Couldn't you POST/GET the base64 to the server then convert it there? [This might help](http://stackoverflow.com/a/11511605/4777622) – Dendromaniac Jul 05 '15 at 00:06

2 Answers2

1

You can send the Base 64 data to the server throw a normal AJAX POST.

Even with jQuery: $.post('/save', {image: base_64_data})

Then in the server, as mentioned on this answer (PHP Example), you can save the image on disk or do whatever you want.

0

As mentioned send it across as a base64 and convert it on the server. It's already been coded to a base64, there is no need to convert it to an image, ie bmp, jpeg, etc., and take the performance hit of encoding the immediately decoding to send.

tuckerjt07
  • 902
  • 1
  • 12
  • 31