I use documentation with WWWForm: https://docs.unity3d.com/Manual/UnityWebRequest-SendingForm.html
C#:
void Start() {
StartCoroutine(Upload());
}
Right now I'm trying the same thing and since WWW class and WWWForm will be deprecated in the next version I tried to found a solution to this problem that does not use the deprecated class. In the end I understand that you don't actually need to use List if you just need to send a form with strings (example, right now I'm using it for a http post for code-flow auth in dropbox). Just use a Dictionary and you'll be fine (you will not even need to use www.chunkedTransfer = false;).
Dictionary<string, string> form = new Dictionary<string, string>();
form.Add("code", token);
form.Add("grant_type", "authorization_code");
form.Add("client_id", myid);
form.Add("client_secret", mysecret);
form.Add("redirect_uri", "http://" + localhost + ":" + port + '/');
I tried all of the above answers and nothing worked, but I noticedd that Unity adds a Request Header :
upgrade-insecure-requests 1
So I upgraded my url to https://
It still didn't work with MultipartFormData
, but it started working with WWWForm form = new WWWForm();
Use WWWForm instead. PHP is expecting application/x-www-form-urlencoded form data, not multipart.
WWWForm form = new WWWForm();
form.AddField("myField", "myData");
UnityWebRequest www = UnityWebRequest.Post(url, form);
This seems to work for me, I hope it helps.
UnityWebRequest www = UnityWebRequest.Post(url, formData);
www.chunkedTransfer = false;////ADD THIS LINE
yield return www.SendWebRequest();