Quantcast
Channel: Questions in topic: "httpwebrequest"
Viewing all articles
Browse latest Browse all 190

How to upload a file from Android to my own website?

$
0
0
I have my own website and am trying to upload a file to it from an Android unity app. This is my code: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking; public class TestScript : MonoBehaviour { void Start() { StartCoroutine(Upload()); } IEnumerator Upload() { byte[] myData = System.Text.Encoding.UTF8.GetBytes("This is some test data"); UnityWebRequest www = UnityWebRequest.Put("http://***myWebsite/myFolder/myNestedFolder", myData); yield return www.SendWebRequest(); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { Debug.Log("Upload complete!"); } } } The problem is that it's returning a Generic/Unknown HTTP error.

Viewing all articles
Browse latest Browse all 190

Trending Articles



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