Hello, i need to store game data in DropBox. Now i have the coroutine to download .json file from using UnityWebRequest, and it works great. But i am having difficulty in writing a Post method to upload a file to DropBox. Hope you help me.
private string downloadUrl = "https://www.dropbox.com/s/27e3nqvw6283l16/data.json?dl=1";
private string text = "";
private void Start()
{
StartCoroutine(Get(downloadUrl));
}
private IEnumerator Get(string url)
{
using (UnityWebRequest request = UnityWebRequest.Get(url))
{
yield return request.SendWebRequest();
if (request.isNetworkError || request.isHttpError)
{
Debug.LogErrorFormat("Request error: {0}", request.error);
}
else
{
text = request.downloadHandler.text;
Debug.LogFormat("Recieved: {0}", text);
}
}
}