mono for android Json 上传文件
void button_Click(object sender, EventArgs e) { string Url = "上传地址,服务器端负责接收"; byte[] fbytes; int Id = 1; string filename = "text.jpg"; string emsg = ""; System.Json.JsonObject id = new System.Json.JsonObject() { //{"fBytes","二进制数据"},{"MemberID","会员ID"},{"fileName","文件名"},{"eMsg",""} {"fBytes",fbytes.ToString()},{"MemberID",Id},{"fileName",filename},{"eMsg",emsg} }; string up = id.ToString(); try { HttpWebRequest request = WebRequest.Create(Url) as HttpWebRequest; request.ContentLength = up.Length; request.Method = "POST"; request.ContentType = "application/json"; StreamWriter stOut = new StreamWriter(request.GetRequestStream(), System.Text.Encoding.Default); stOut.Write(up); stOut.Close(); //request.BeginGetResponse(new AsyncCallback(ProcessRestJSONLINQHttpResponse), request); } catch (Exception) { throw; } }
以前的我是没有做笔记的习惯的,学习了后觉得自己能记住,但是最近发现很多学的东西都忘记了,所有现在一有新的知识,就记下来吧。
最近又做一个mono for android 的项目 这次调整比较大,上次做的点餐系统很好用 ,但是做的时候没有做笔记很多东西都忘记了,这次我把项目涉及到的知识传到博客上,方便记忆,也很大家分享分享的,希望大家能给出点意见。——小査