//------------------------------------------------------------------------- public void uploadProfileImage(string account_id, MemoryStream stream, OnUCenterUploadProfileImage handler) { if (WWWUploadProfileImage != null) { return; } UploadProfileImageHandler = new Action <UCenterResponseStatus, AccountUploadProfileImageResponse, UCenterError>(handler); string http_url = _genUrl("upload/" + account_id); byte[] bytes = stream.ToArray(); Dictionary <string, string> headers = _genHeader(bytes.Length); WWWUploadProfileImage = new WWW(http_url, bytes, headers); }
//------------------------------------------------------------------------- public void uploadProfileImage(string account_id, MemoryStream stream, OnUCenterUploadProfileImage handler) { if (WWWUploadProfileImage != null) { return; } UploadProfileImageHandler = new Action <UCenterResponseStatus, AccountUploadProfileImageResponse, UCenterError>(handler); string http_url = _genUrl(account_id + "/upload"); byte[] bytes = stream.ToArray(); //int width = 640; //int height = 640; //var tex = new Texture2D(width, height, TextureFormat.RGB24, false); //byte[] bytes = tex.EncodeToJPG(); WWWForm www_form = new WWWForm(); www_form.AddField("frameCount", Time.frameCount.ToString()); www_form.AddBinaryData("file", bytes, "profile.jpg", "image/jpg"); WWWUploadProfileImage = new WWW(http_url, www_form); }