日期:2014-05-18 浏览次数:20530 次
string postData = "access_token=" + access_token; postData += "&status=" + Server.UrlEncode(GetWeather()); postData += "&pic="; FileStream file = new FileStream("C:\\Documents and Settings\\zhengw.BAUERHOME\\桌面\\weather.png", FileMode.Open, FileAccess.Read); BinaryReader read = new BinaryReader(file); int count = (int)file.Length; byte[] buffer = new byte[count]; read.Read(buffer, 0, buffer.Length); string msg = Encoding.UTF8.GetString(buffer); data = encoding.GetBytes(postData+msg); request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentType = "multipart/form-data"; request.ContentLength = data.Length;
response = (HttpWebResponse)request.GetResponse();