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

Using UnityWebRequest POST to upload image files

$
0
0
Hello! I'm trying to upload image files using the UnityWebRequest class. My code looks like this: //get image var imageData = _sprite.texture.GetRawTextureData(); var data = new List { new MultipartFormDataSection("foo", "bar"), new MultipartFormFileSection("myImage", imageData, "test.png", "image/png") }; //init handshake var handshake = UnityWebRequest.Post("http://mypage/uload.php", data); var request = handshake.SendWebRequest(); //response request.completed += (action) => { if (!handshake.isHttpError && !handshake.isNetworkError) { Debug.Log(handshake.downloadHandler.text); } }; The response looks like this: Array ( [myImage] => Array ( [name] => test.png [type] => [tmp_name] => [error] => 3 [size] => 0 ) ) Does anyone have an idea what i'm doing wrong?

Viewing all articles
Browse latest Browse all 387

Trending Articles



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