0

I am trying to post some variables to PHP server via json. One of this variable contains huge string. When I post data all other variable get posted successfully but one that contains huge string remains undefined.

If I make content of that variable sort, then its running fine.

$.ajax({
          type: 'POST',
          url: url,
          data:{name:”aaa”,age:”aaaaa”,detail:”huge string”},
          async:false
        }).done(function( data ) {
            alert(data);
          }).fail(function() {
           $.notify("Cannot connect to server", "error");
        });
  • 3
    How huge? Maybe check this http://stackoverflow.com/questions/2364840/what-is-the-size-limit-of-a-post-request – GôTô Apr 15 '14 at 12:27
  • 1
    Lines? How long would such a line be? 5 bytes? 500 bytes? (Basically, we need the total length of the string) – Cerbrus Apr 15 '14 at 12:29
  • 1
    Is this your real code? Do you escape the string? – GôTô Apr 15 '14 at 12:30
  • @GôTô i guess it is an string encoding issue too – A. Wolff Apr 15 '14 at 12:32
  • okay, let me tell u fact. i am sending javascript code to server. it can be in MBs. but for now i am testing it for around 900kb. i put javascript in json variable – user3326391 Apr 15 '14 at 12:32
  • @user3326391 Any reason to set it synchronous?! – A. Wolff Apr 15 '14 at 12:33
  • nope, but i tried. it's not make any difference. problem remain same – user3326391 Apr 15 '14 at 12:34
  • @user3326391 But have you tried: `detail:encodeURIComponent(”huge string”)` ?! – A. Wolff Apr 15 '14 at 12:36
  • i tried both escaped and not escaped . but problem is still there. – user3326391 Apr 15 '14 at 12:36
  • just tried encodeURIComponent(”huge string”) .. not working :( – user3326391 Apr 15 '14 at 12:40
  • Any chance we can see an online example?! – A. Wolff Apr 15 '14 at 12:44
  • is your PHP hardened with Suhosin-Patch ? If yes: try again after desactivating it. – Jscti Apr 15 '14 at 13:33
  • sorry guys, i still can't detect problem in my code, but i made same sample code in new project as per your demand @A. Wolff. but it's working perfectly :P. i thought may be probem with codeigniter framework so i tried same sample code with codignirer also and it's also working completely. so i don't know how to show a problem :(. any way,.. i will find it out, thank you all – user3326391 Apr 15 '14 at 13:39
  • finally got answer. and problem is XSS filter in codeigniter. just disable global_xss_filtering and it's works fine :). thank you guys :) – user3326391 Apr 15 '14 at 14:14

1 Answers1

0

please check your php.ini setting for directive

post_max_size

and try to increase like as below

ini_set('post_max_size' '20m')
sandipshirsale
  • 791
  • 7
  • 11