Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't POST large html5 canvas to server?
    text
    copied!<p>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. </p> <p>To do this, I <code>xMLHttpReq.send(*)</code> the <code>encodeURIComponent(canvasP.toDataURL())*</code> via a <code>xMLHttpReq.open("POST", url, false);</code></p> <p>In my php script, I take the $_POST and <code>base64_decode(json_decode($_POST[data]))</code> and I save it to a .png file on the server.</p> <p>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.</p> <p>How do I fix this? How can I send a large canvas to the server? </p> <p>Is the problem a limitation to _POST size? Because, no matter how large the canvas is, I can always download it via a <code>window.open(canvasP.toDataURL(), "blabla");</code>.</p> <p>This is quite the dilemma for me. Any help will be much appreciated!</p> <p>[EDIT] The PHP simply receives empty <code>$_POST[data]</code> for anything over ~50-something kB... So the problem has to occur between <code>canvasP.toDataURL()</code> and the POST-ing...</p> <p>[EDIT2] Browser says "Uploading...(xx%)" until it's "done". SO WHERE DOES THE DATA GO? :C</p> <p>[EDIT3] Here's the app, try it for yourself (use google chrome): <a href="http://students.info.uaic.ro/~tudor.berechet/" rel="nofollow noreferrer">http://students.info.uaic.ro/~tudor.berechet/</a></p> <p>[EDIT4] Mike's answer seems to be right about suhosin <img src="https://i.stack.imgur.com/epRbv.png" alt="phpinfo screenshot"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload