x


Server requirement for WWW.uploadProgress to work?

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).

more ▼

asked May 07 '12 at 01:51 PM

mcen gravatar image

mcen
1 1 2

(comments are locked)
10|3000 characters needed characters left

0 answers: sort oldest
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x525
x69
x63
x29

asked: May 07 '12 at 01:51 PM

Seen: 457 times

Last Updated: May 07 '12 at 01:51 PM