I am making this PUT request via Postman that has form-data body: PUT request
And trying to populate the model using this line:
$model->load(Yii::$app->request->getBodyParams(), '');
See, I tried to print worker_id, time_out params of the request on debug console, but getting null. And getBodyParams() is only returning an array of one ("image") element
For methods other than
POSTYii2 doesn't use$_POSTarray to get body params. It usesmb_parse_str()on raw body instead. This approach probably have problem parsing multipart request body.To make yii2 parse multipart body properly you have to add
yii\web\MultipartFormDataParsertoyii\web\Request::$parsersformultipart/form-datacontent type.You can add it in your config like this: