David Weisser
David Weisser

Reputation: 326

Array losing records on post with ajax

I have an array in jQuery resulting from a csv. It is created by:

var csvrows = e.target.result.split("\n");

It looks like this:

"1,Fred,Dryer,[email protected],Backfield,North\r","2,Franco,Harris,[email protected],Corp,South\r","3,Jim,Brown,[email protected],Field,South\r","4,Fred,Dryer,[email protected],Backfield,North\r",etc.

The csv has 1200 rows in it. I verify it's length in the console with:

console.log('records: ' + csvrows.length)

records: 1200

I post it by ajax for processing and database insertion.

$csvdata = $_POST['csvdata'];

The problem is this. print_r($csvdata) stops at row 992.

I'm losing data on post. No clue why. MySQL packet size? Is there some kind of string length with the array in ajax? I explode and trim CSVdata in php to add keys and remove the \r. maybe if I did that in jQuery before post?

Any thoughts?

Upvotes: 0

Views: 39

Answers (1)

spyro95
spyro95

Reputation: 146

What is your max post size? Did you check whats arriving (debug in php script)?

Thats the setting for post size(php.ini):

post_max_size=8M 

Upvotes: 0

Related Questions