Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$_POST['data'] is not defined, if data is too large

I would like to send a ~10MB json data in a textarea named "data". If the data is 1-2KB, then it works perfectly. But with a large json, the $_POST['data'] is empty for some reason.

I can't upload the json otherwise, because it is generated clientside, it's not a file.

I've tried this code, but still not working:

form.setAttribute('enctype', 'multipart/form-data');

Edit

With this settings it is still not working:

memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M

Edit2

If I switch from php 5.4 to 5.6, then I get an 500 error page, with no details written on the screen.

like image 940
Iter Ator Avatar asked Nov 17 '15 19:11

Iter Ator


1 Answers

You need to change post_max_size to enough (20MB) in the php.ini file.

By default, PHP permits a maximum file upload of 2MB.

Two PHP configuration options control the maximum upload size: upload_max_filesize and post_max_size. Both can be set to, say, 20M for 20 megabyte file sizes or higher if required.

like image 101
Bas van Stein Avatar answered Oct 11 '22 04:10

Bas van Stein