I wanna save the canvas as png. The size of the canvas is about 2000x2000px, canvas.toDataURL()
returns 5.600.000 chars (700 KB). When I try to send it to the server, I get an 413 request entity too large
error. There isn't any size limit for ajax post. In the server, the LimitRequestBody is 2 GB, more than I need, post_max_size is 132M.
Any idea, why I get this error?
Or are there a better way to save the image? I use fabric.js. I tried to draw the image with php, but I had many problems. Do you know any frameworks that can draw the same as the fabric.js?
Asked
Active
Viewed 833 times
0
-
1Assuming you've tested your upload code with a smaller file and that test succeeded, be sure you’ve configured your php server with appropriate upload limits: post_max_size, upload_max_filesize, max_execution_time. – markE Jan 25 '14 at 20:36
-
post_max_size is more than I need. upload_max_filesize isn't essential, I'm not uploading any file (but it's 2000M lol). max_execution_time is 60. And yes, I tested it with a smaller image. When the canvas was about 750x750, it worked well, I could save the image. – klenium Jan 25 '14 at 21:16
-
Ok...is your upload directory set to other than the tmp directory and does that upload directory have sufficient disk space. You might try to reduce the size of post_max_size to something reasonable(maybe 16M). Are you running other components (like nginx) that need to be configured also? Realistically, it's very difficult to diagnose network config problems on a forum like stackoverflow... – markE Jan 25 '14 at 21:27
-
5,600,000 chars is not 700KB, it is ~ 5.5MB, how did you calculate it? – arty Jan 27 '14 at 08:28
2 Answers
1
You don't have acess to your server php.ini, right?
Try use ini_set function:
For example:
ini_set('post_max_size', '10M');
ini_set('upload_max_filesize', '10M');
ini_set('max_execution_time', 0);
Or try put a .htaccess
file in the same directory as your .php:
php_value upload_max_filesize 10M
php_value post_max_size 10M
php_value max_execution_time 0
Please note that 0 (zero) is infinite in max_execution_time
.
I hope this help.

ptCoder
- 2,229
- 3
- 24
- 38
0
you can go to the php.ini file and resize the max_post_lenght