Hi!
I’ve a problem with the WWW class using wwwForm (with a binary field) as byte array (data property).
I need to send headers with WWW, the only overload constructor that permits it, is public WWW(url: string, postData: byte[ ], headers: Dictionary<string,string>)
and has the postData parameter as byte array. I converted the wwwForm to byte array using the “data” property.
If the form doesn’t contain binary data all works well but if in the form there is at least one binary field, the server has some problem to read parameters.
Has anyone encountered this problem and found a solution?
WWWForm wwwForm = new WWWForm ();
wwwForm.AddField (“testKey”,“testValue”);
wwwForm.AddBinaryData (“testKeybinary”,new byte[1]); //binary data
Dictionary<string,string> headers = new Dictionary<string,string>();
headers.Add(“customheader”,“customheadervalue”);
WWW www = new WWW (baseURL,wwwForm.data,headers);
yield return www;
if (www.error!=null) {
Debug.Log("ERROR: " + www.error + " - " + www.text);
} else {
Debug.Log("RESPONSE: " + www.text);
}