way to batch importing to stay under the max_input_vars
way to batch importing to stay under the max_input_vars
I used https://editor.datatables.net/examples/extensions/import as a reference to create an import process, however I am getting, "Too many rows edited at the same time (tech info: max_input_vars exceeded)."
I may not have the ability to expand max_input_vars because of where the server is hosted.
I am trying to find a workaround without retooling a bunch of stuff.
Is there a way to auto-batch through the data being uploaded so it only uploads X number of records at a time?
Answers
Hi,
There is no built in option for that specifically I'm afraid. What would need to happen is to use
ajaxas a function to split the payload over multiple requests (probably in a queue rather than firing them all off at once) before then finally calling the callback function to tell Editor that it has been updated. You'd need to keep a hold of the responses from the server to build up the data array as well. Using this route you may wish to do a validation submit before a write submit, to make sure all of the data is valid before writing anything to the db.That all said, there is another option -
ajax.submitAs. You could have the client submit the entire data set as the request body, rather than as parameters.The upshot is that on the server-side you would need to use something like:
Then do
->process($json)rather than->process($_POST).The second option is definitely easier! Depending on how much data you are submitting you might need to watch out for
post_max_sizeand also processing duration though.Allan
Is there a working example of utilizing ajax.submitAs and the PHP processing?
I'm afraid there isn't, no. However, the
edit.phpscript in this example (which you would need to access from the download package, it isn't available on that page), uses thephp://inputmethod to read a request body.It should be just as I've described - use:
And then the PHP code from above. Possible you might need to check for
$postDatabeing empty before attempting to JSON decode it.Allan
I am trying to implement this. I am able to read but when I try to save an edit , I get an error. DevMode shows:
HTTP Error 405.0 - Method Not Allowed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.
Below is the call to put:
below is the php:
I'm not seeing any errors in the server logs
Actually I found this error:
Fatal error: Uncaught TypeError: json_decode(): Argument #1 ($json) must be of type string, array given in C:\ClientSites\da-pool.com\jyorkejudge4.org\php\voting2_edit_test.php:26 Stack trace: #0 C:\ClientSites\da-pool.com\jyorkejudge4.org\php\voting2_edit_test.php(26): json_decode() #1 {main} thrown in C:\ClientSites\da-pool.com\jyorkejudge4.org\php\voting2_edit_test.php on line 26
Did you try checking for the content being empty as I suggested above? That might help:
Allan
Yes, but I am not sure if control is being passed to voting2_edit_test.php as I am writing to my log file early in the code, and I don't see any entries in my log.
Below is what my AJAX calls should look like?
I didn't see submitAs used in the examples: https://editor.datatables.net/examples/advanced/REST.html
Looks okay - what does the Ajax request look like? Can you link to the page in question?
Allan
Thank you.
https://jyorkejudge.org/votinguploado_test.php
I am trying to implement REST so I can upload a larger file. I am able to get the data and populate the page, now I am trying to do a simple edit.