예제 #1
0
        void GotWallUploadServer(VKRequest arg1)
        {
            if (arg1.error != null)
            {
                _callbackFunction(arg1);
                return;
            }

            var dict = Json.Deserialize(arg1.response) as Dictionary <string, object>;
            var resp = (Dictionary <string, object>)dict["response"];
            var url  = (string)resp["upload_url"];

            foreach (var i in _images)
            {
                var file = new FileForUpload {
                    data = i.data, filename = i.imageName, mimeType = (string)i.imagetype
                };
                VKRequest r = new VKRequest()
                {
                    fullurl          = url,
                    CallBackFunction = PhotoHasBeenUploaded,
                    data             = new object[] { RepeatRequest, file }
                };

                vkapi.UploadToserverCall(r, file);
            }
        }
예제 #2
0
        private IEnumerator _UploadToserverCall(VKRequest httprequest, FileForUpload file)
        {
            var www = GenerateWWWForm(httprequest, file);

            yield return(www);

            HandleResponse(www, httprequest);
        }
예제 #3
0
        private WWW GenerateWWWForm(VKRequest httprequest, FileForUpload file)
        {
            VKRequest _request = httprequest;
            WWWForm   form     = new WWWForm();

            form.AddBinaryData("file", file.data, file.filename, file.mimeType);
            return(new WWW(System.Uri.EscapeUriString(_request.fullurl), form));
        }
예제 #4
0
 public void UploadToserverCall(VKRequest requestString, FileForUpload file)
 {
     StartCoroutine(_UploadToserverCall(requestString, file));
 }