I am using UnityWebRequest
to form a multipart request and upload a file to the server. To track the progress I am checking uploadProgress
property of this request. The progress works well on Windows in Editor mode but when I am running it on android, the uploadProgress
always is set to 1.
Does the uploadProgress
property works on android? How can I track the uploading progress?
UPD Here is a sample function 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);
}
}