Upload progress of file on unity WebGl
I need to show the upload progress of a file I´m uploading to a certain server, most likely a video, with my actual code the video does upload to the server after some time. The documentation aboput web gl says that I can´t block the unity web request with while(!www.IsDone), it just hangs all the app, i tested it. But still I need to show the upload progress or at least tell the users that the video uploads correctly. How can I achieve it? This is my code:
public IEnumerator SaveFile(byte[] data) { WWWForm form = new WWWForm(); form.AddBinaryData("data", data); form.AddField("fileName", "Video"); form.AddField("saveLocation", targetData.ServerDiirTarget.ServerDirMainTarget); Debug.Log(targetData.ServerDiirTarget.ServerDirMainTarget); UnityWebRequest www2 = UnityWebRequest.Post("http://ready4ar.com/WebServices/VideoUploader.ashx", form); www2.SendWebRequest();
yield return www2;
Debug.Log("respuesta del server:" + www2.downloadHandler.text);
if (!www2.isNetworkError || !www2.isHttpError)
{
Debug.Log("completado");
}
else
{
Debug.Log("error:" + www2.error);
}
}
this code works but it is not able to show progress of the uploaded video.
Your answer
Follow this Question
Related Questions
Error in BUILD with UnityWebRequest but not in Editor 0 Answers
UnityWebRequist Return 403 0 Answers
How to make a script wait for a UnityWebRequest to finish for WebGL without a coroutine? 1 Answer
WebGL CORS error when trying to get text from a URL. Even when CORS is set? 0 Answers
UnityWebRequest error on WebGL 0 Answers