1

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);
    }
}
Dmitry
  • 59
  • 7
  • 1
    Without your code, it is impossible to know if it is your fault or an API bug. Please edit your question and add your code! – Programmer Oct 24 '17 at 05:09
  • It is possible that android web browser must have disabled the javascripts. you need to put code for more details. – Niraj Sanghani Oct 24 '17 at 06:46
  • Even with your update it's still not complete. No one knows where `MultipartBody` came from. My post [here](https://stackoverflow.com/a/46008025/3785314) describes how to send Multipart data through `MultipartFormFileSection`. You may want to read that. I will likely close this since that post described how to use Multipart . – Programmer Oct 24 '17 at 07:06
  • Updated code sample – Dmitry Jan 24 '18 at 12:13

0 Answers0