views:

905

answers:

1

I’m using jquery to send text back to my ajax.php controller like this:

var dataString = "1234567890";      
$.post(
    '../ajax/save',
    { data: dataString },
    function(){
        alert("success");
    },
    "text");

It works well, that is until the dataString gets to be ~3500 characters long. At that upper limit (~3.5 KB), the $_POST received by ajax.php is NULL. Why?

(My php.ini post_max_size = 64M, so it’s not that.)

My setup: Apache 2.2, PHP 5.2.9, and CodeIgniter 1.7.1.

A: 

I figured it out. For some reason NetBeans' debugger tells me $_POST['data'] is null, but it's not. To manually determine the size of the $_POST received, I used these calls:

$request = http_build_query($_POST);
$size = strlen($request);

Also, I was putting $_POST['data'] into CodeIgniter's session:

$event_array = array('event' => $_POST['data']);
$this->session->set_userdata($event_array);

Which was coming up empty leading me to further believe that $_POST was empty. But the problem was instead $this->session, which apparently has a 4K size limit (according to this post).

twh