1

So I'm using Cropper to let a user resize and do some stuff to an image. The edited image is in a canvas element which I run .toDataURL() on. This creates a base64 string of the 'finished product'.

I need to programmatically save the edited image to a folder on the server.

I can't do this with an $.ajax request because I can't pass such a long query via a $_POST/$_GET command.

Some other details/information:

  • this is a WordPress website (not that this makes a difference, I dont think)
  • the edited image is about 300x300
  • i need to support IE9 so client-side file-saving isn't an option
Mark
  • 407
  • 7
  • 17
  • Possible duplicate of [upload large files using php, apache](http://stackoverflow.com/questions/1700207/upload-large-files-using-php-apache) – 0x9BD0 Nov 11 '15 at 15:25

2 Answers2

0

Since you have a base64 string, you could use chuncking, i.e. split the string and send it in small portions to the server via ajax. You need to think about signalising "start" and "end"

svrnm
  • 1,036
  • 6
  • 17
  • Interesting angle, thanks @svrnm. Will wait a bit longer to see if any other ideas come in and then give that a try. – Mark Nov 11 '15 at 15:54
0

*facepalm

Used $.post instead... Works now :)

Mark
  • 407
  • 7
  • 17