Error:
Unable to verify your data submission error
Create one public function in Yii2. But, submit data not accept in this method, see following error images. Why is this happen?
Unable to verify your data submission error
Create one public function in Yii2. But, submit data not accept in this method, see following error images. Why is this happen?
Also sometimes you can get this error using Yii 2.0 due to the post_max_size, upload_max_filesize, max_input_time also too maybe the webserver can be trimming the post so verify on nginx - client_max_body_size or in apache - LimitRequestBody
A long story has been discussed here github
So disabling csrf somehow unsure for ajax request. I have met this issue many times.
So remember to send _csrf key when you send data by POST via ajax.
If you create the form manually (i.e. without using the yii form methods), you should add an input field like this:
source: http://zero-exception.blogspot.com/2015/01/yii2-using-csrf-token.html
There are various solutions to this problem, I guess understanding why it happened in the first place helps solve the problem.
If CSRF is not the issue,
If you are running linux, check php.ini file for inputs like these:
Based on your calculations, adjust the above php.ini parameters to suite your needs, then test. I had a similar problem and I solved it.
To permanently disable csrf validation in whole application add below code in your configurations.
$csrf = \yii::$app->request->csrfParam;
$token = \yii::$app->request->csrfToken;
//start from
echo Html::hiddenInput($csrf,$token);
//end from