Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

upload image to server

$
0
0
i want to uploaded image to server from from anroid and ios device to server.I am using following code it is working fine in editor to upload the file from my windows system but code fails when uploaing from anroid and ios device after i tested in app file. IEnumerator UploadFileCo(string localFileName, string uploadURL) { WWW localFile = new WWW("file:///" + localFileName); yield return localFile; if (localFile.error == null) Debug.Log("Loaded file successfully"); else { Debug.Log("Open file error: " + localFile.error); yield break; // stop the coroutine here } WWWForm postForm = new WWWForm(); // version 1 //postForm.AddBinaryData("theFile",localFile.bytes); // version 2 postForm.AddBinaryData("theFile", localFile.bytes, localFileName, "text/plain"); WWW upload = new WWW(uploadURL, postForm); yield return upload; if (upload.error == null) Debug.Log("upload done :" + upload.text); else Debug.Log("Error during upload: " + upload.error); } please help me how to upload the file from anroid and ios device

Viewing all articles
Browse latest Browse all 4709

Trending Articles



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