I have a canvas that you can paint on. I need to save it's contents to the server so it can be resumed later.
To do this, I xMLHttpReq.send(*)
the encodeURIComponent(canvasP.toDataURL())*
via a xMLHttpReq.open("POST", url, false);
In my php script, I take the $_POST and base64_decode(json_decode($_POST[data]))
and I save it to a .png file on the server.
NOW, this works fine and dandy if the canvas has a small doodle on it. BUT if the 1600x1200px canvas has a lot of stuff drawn on it, and it's like 600kB in size, my script fails, and I get a 0kB png on my server.
How do I fix this? How can I send a large canvas to the server?
Is the problem a limitation to _POST size? Because, no matter how large the canvas is, I can always download it via a window.open(canvasP.toDataURL(), "blabla");
.
This is quite the dilemma for me. Any help will be much appreciated!
[EDIT] The PHP simply receives empty $_POST[data]
for anything over ~50-something kB...
So the problem has to occur between canvasP.toDataURL()
and the POST-ing...
[EDIT2] Browser says "Uploading...(xx%)" until it's "done". SO WHERE DOES THE DATA GO? :C
[EDIT3] Here's the app, try it for yourself (use google chrome): http://students.info.uaic.ro/~tudor.berechet/
[EDIT4] Mike's answer seems to be right about suhosin