This topic is locked
[SOLVED]

 Ajax data transfer truncated

7/16/2012 8:06:25 PM
PHPRunner General questions
pberis author

I am building a page on client side that I want to save in mysql ... Everything works fine on my dev box but when I try to execute in the production environment I get empty data on the server side. It appears as though the field is getting silently rejected due to size. I tried reducing the size and it appears to xfer successfully up to a point.
I also tried breaking the field up into smaller chunks but still appear to run into an overall size limit.
The total size that I am trying to xfer is ~110K.
I assume this is a problem with one of the packet/transaction size limits but am as yet unable to determine where the problem lies.
Appreciate any help ... especially with ways to trouble-shoot this type of problem.
The deployment system is a basic LAMP server on a vps.
Apache:
Server version: Apache/2.2.22 (Unix)

Server built: Mar 11 2012 01:41:15

Cpanel::Easy::Apache v3.10.2 rev9999
PHP:
PHP 5.2.17 (cgi-fcgi) (built: Mar 11 2012 01:51:14)

Copyright (c) 1997-2010 The PHP Group

Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

with the ionCube PHP Loader v4.0.12, Copyright (c) 2002-2011, by ionCube Ltd.

C
cgphp 7/17/2012

Do you get errors in firebug? Post the ajax call code.

pberis author 7/17/2012



Do you get errors in firebug? Post the ajax call code.


Javascript Client Before:

This works:
<code>

var btnSet = $("#"+ctrl.id); // Re-cast the current controller so we can use JQuery extensions

console.log("Button:");

console.log(btnSet);
params['targeturi'] = btnSet.data('targeturi');

params['userid'] = btnSet.data('userid');

params['groupid'] = btnSet.data('groupid');

params['href'] = window.href;
// Store off the new document and send it

var ifDoc = window.ifrm.contentDocument;

var htDoc = ifDoc.getElementsByTagName('html')[0].innerHTML;

params["html0"] = htDoc.substr(0,25000);

params["html1"] = htDoc.substr(25000,25000);

params["html2"] = htDoc.substr(50000,25000);

params["html3"] = htDoc.substr(75000,15000);
var str = location.pathname.substr(location.pathname.lastIndexOf("/")+1).replace(".php",".html");
params["pageName"] = prompt("Please enter a name for this page: ",str);

displayMessage("Sending document "+params["pageName"]+" ("+htDoc.length+") to server for storage .... stand by ....");
console.log(params);

</code>
****

If I add 5 more K of data to the html it fails with the following:

  • f.support.ajax.f.ajaxTransport.send.d

[/list]

****

Sending as a single parameter:
<code>

params["html"] = htDoc;

</code>
silently fails .... everything looks OK but the value of the 'html' parameter is empty on server side.
---------------------------------------------------------------------------------------------------------------------------------------------------

Server Side PHP:
<code>

$userID = $params['userid'];

$groupID = $params['groupid'];

$fName = $params['pageName'];

$URI = $params['targeturi'];

$URI = "http://localhost:8085/${URI}";;
$htDoc = addslashes($params["html0"]);

$htDoc .= addslashes($params["html1"]);

$htDoc .= addslashes($params["html2"]);

$htDoc .= addslashes($params["html3"]);
//$result = $params; // Send back what I received

$result["replaced"] = 'false';

$result["fulluri"]=$URI;

//$result["html"]=$htDoc;

$result["length"]=strlen($htDoc);
$result["SQL"] = "DELETE FROM tbluserpages

WHERE UserID='$userID'

and PageName='$fName'

and GroupID='$groupID'

";
CustomQuery($result["SQL"]);

$result["replaced"] = 'true';
$result["SQL"] = "Insert into tbluserpages (

UserID

, GroupID

, PageName

, Document )

Values (

$userID

, $groupID

, '$fName'

, \"$htDoc\" ) ;";
CustomQuery($result["SQL"]);

$result["stored"] = 'true';

</code>

****
It feels like I am hitting two limits, one for the size of a single field and another for the total transaction size.