Quantcast
Channel: Questions in topic: "webrequest"
Viewing all articles
Browse latest Browse all 387

Uploading files to DropBox using UnityWebRequest.

$
0
0
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); } } }

Viewing all articles
Browse latest Browse all 387

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>