SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question XHR POST size limit

    Hi,

    I have a problem with XHR size limit. I want to transmit text information for page to a PHP script which saves it in a MySQL database but the data are cut off. When I reload the page the changes I made are gone. Firebug produces the following message:

    ... Firebug request size limit has been reached by Firebug. ...

    this is my XHR function:

    function makeXHR(recordData)
    {
    xmlhttp = createXHR();

    var body = "q=" + encodeURIComponent(recordData);

    xmlhttp.open("POST", "insertRowData.php", true);
    xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlhttp.setRequestHeader("Content-length", body.length);
    xmlhttp.setRequestHeader("Connection", "close");

    xmlhttp.onreadystatechange = function()
    {
    if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
    {
    alert(xmlhttp.responseText);
    }
    }
    xmlhttp.send(body);

    }

    My question is: Is there a size limit in XHR POST requests? If yes how to disable it or is a browser issue?

    regards.

  2. #2
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    The limit will be the same as for regular posts, which depends largely on server configuration (e.g. if you're using PHP there's a max_post_size setting).

    How large is the data? MySQL TEXT fields are limited to +/- 64K characters, so you might need to use MEDIUMTEXT (size is about +/- 10Mb).

    Firebug only displays a certain amount of data, otherwise Firebug itself might crash (dragging the browser down with it).

  3. #3
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi,

    it works now. the problem was not the post size but my regular expression search term. i also increased my php_max_size but the data will only be around 200K.

    thx


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •