I'm still new to this business. The situation is this: sending an array of strings via JSON, but only 1000 strings arrive on the server. How to fix it?
var data = DataArr; alert(data.length);//тут более 1000 строк if (id == 0) { $.ajax({ type : 'POST', url : 'createFile.php', dataType : 'json', data : { '0' : data }, response : 'text', success : function(data) { alert("Выполнено!"); DownloadFile(data.path, 0); } }); DataArr.length = 0; } On the server side I accept:
global $file; if (!empty($_POST['0'])) { $rand = uniqid(); mkdir(dirname(__FILE__) . "/files/" . $rand); $dataArr = $_POST['0']; echo (count($dataArr));//а тут ровно 1000 строк $file = "/files/" . $rand . "/" . $dataArr[0]; $fp = fopen(dirname(__FILE__) . "/files/" . $rand . "/" . $dataArr[0], "w"); for ($i = 1; $i < count($dataArr); $i++) { fwrite($fp, $dataArr[$i] . "\r\n"); } fclose($fp); $json_path = array('path' => $file); echo json_encode($json_path); }
max_input_varsincrease anything? and how can cut lines if json is one line? - Alexey Shimansky