- Home /
Question by
mcen · May 07, 2012 at 01:51 PM ·
wwwuploadprogress-barprogress
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).
Comment
Your answer
Follow this Question
Related Questions
www.uploadProgress not working on Android 0 Answers
Problem with WWW.progress 3 Answers
Load bar in GameObject 2 Answers
Failed to upload image over custom server 3 Answers
WebRequests have very slow transfer speed for large uploads 0 Answers