Is there any specific requirements on server end to get WWW.uploadProgress to work?
Texture2D tex = (Texture2D)Resources.Load("back");
byte[] bytes = tex.EncodeToPNG();
//Remove the unused texture
Destroy(tex);
//Create POST data
var form = new WWWForm();
form.AddField("authToken", "abc123");
form.AddBinaryData("levelImage", bytes);
WWW www = new WWW(API_ENDPOINT + "/levels", form);
while (!www.isDone)
{
Debug.Log(www.uploadProgress.ToString("F4"));
yield return null;
}
yield return www; //Execute the www request
if( www.error != null )
{
Debug.Log(www.error);
}
Debug.Log("Image uploaded");
This code simply go from 0 to 1 but nothing between the values.
I have created a REST API in rails for running this (using default webrick server 1.3.1 with Ruby 1.9.2 at the moment).
asked
May 07 '12 at 01:51 PM
mcen
1
●
1
●
2