- Home /
UnityWebRequest uploadProgress
Hi,
I am using UnityWebRequest to form multipart request and upload file to server. To track progress I am checking uploadProgress property of this request. The progress works well on window in Editor mode but when I am running it on android, the uploadProgress always is set to zero.
Does the uploadProgress property works on android? How can I track the uploading progress?
Answer by ledentsov · Jan 24, 2018 at 11:58 AM
Here is a sample code that demonstrates it:
public IEnumerator SendFile(byte[] bytes)
{
List<IMultipartFormSection> formData = new List<IMultipartFormSection>();
formData.Add(new MultipartFormFileSection("file", bytes, "file_name", "application/octet-stream"));
var webRequest = UnityWebRequest.Post("url", formData);
webRequest.SendWebRequest();
while (!webRequest.isDone)
{
yield return null;
// Progress is always set to 1 on android
Debug.LogFormat("Progress: {0}", webRequest.uploadProgress);
}
}
Your answer
Follow this Question
Related Questions
UnityWebRequest.POST calls to an HTTPS url throws "Unknown error" on specific device 0 Answers
How to make an android multiplayer....Hotspot connectable game in unity?? 0 Answers
Multiplayer Networking for Android 0 Answers
UNET can't join android server 0 Answers
Mirror Matchmaking, Matchmaking System Using Mirror 3 Answers