wwwForm with binary Field as byte array, form parameter issue

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);:wink:
} else {
Debug.Log("RESPONSE: " + www.text);:wink:
}

I have same problem!. There isn’t solution?

I’m having the same problem, using

wwwForm.AddField("testKey", "value");
wwwForm.AddBinaryData("testKeyData", System.Text.Encoding.UTF8.GetBytes("value"));
WWW www = new WWW(baseURL, wwwForm);

works as expected, but if i do

wwwForm.AddField("testKey", "value");
wwwForm.AddBinaryData("testKeyData", System.Text.Encoding.UTF8.GetBytes("value"));
WWW www = new WWW(baseURL, wwwForm.data);

the server receives both testKeyData and testKey as files(?)

I reported the bug.

Same problem for me.
It seem a WWW bug.

** @Graham-Dunnett any feedback from unity team? :)**

Don’t know. What’s the bug number from @Steva ?

I just have this:
http://fogbugz.unity3d.com/default.asp?716109_vk782ktbvr7fj9hj

Looks pretty good as a bug report. Not completely sure about the need to do something in PHP on a server. Will ask the QA guys to follow up with you.

The QA team has been able to reproduce the bug.
Since there is not a valid workaround, please vote this bug for a more rapid resolution via this link

@Graham-Dunnett Is this problem fixed with WebRequest upcoming features in Unity3D 5.2?

Any feedback from Unity team?

Please, any news?

up