WebClient wx_upload = new WebClient();
string filename =FileUpload1.PostedFile.FileName;//在IE浏览器里可以取到物理路径,但是在别的浏览器中无法获取物理路径
string extension = System.IO.Path.GetExtension(filename).ToLower();
if (extension == ".jpg")
{
string imagename=Uploadimage(filename);
byte[] result = wx_upload.UploadFile(new Uri(String.Format("http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token={0}&type={1}", Function.GetAccessToken(), "image")), filename);
string resultjson = Encoding.Default.GetString(result);//在这里获取json数据,以获取media_id
}