J
J
Jurp2019-01-14 20:41:16
Yii
Jurp, 2019-01-14 20:41:16

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);
  }

In Yii2
public function actionUpload($data)
    {		
          mkdir($data);	
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Андрей, 2019-01-14
@VladimirAndreev

Csrf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question