Answer the question
In order to leave comments, you need to log in
Unity post data to Yii2?
How to pass data to Yii2 from Unity using the Post method? My implementation returns a 400 Bad Request error.
In Unity
IEnumerator UploadData()
{
WWWForm form = new WWWForm();
form.AddField("r", "getdata/upload");
form.AddField("data", "text");
UnityWebRequest www = UnityWebRequest.Post("https://somesite.ru/web/index.php", form);
www.chunkedTransfer = false;
yield return www.Send();
if (www.isNetworkError)
Debug.Log(www.error);
else
Debug.Log("Uploaded");
Debug.Log(www.downloadHandler.text);
}
public function actionUpload($data)
{
mkdir($data);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question