使用上传图像到网络服务时遇到问题web client
,我的代码是--->
Uri uri = new Uri("http://localhost/Test/SaveImage");
string imageData = Convert.ToBase64String(data);
WebClient web = new WebClient();
web.UploadStringAsync(uri, "Post", imageData);
web.UploadStringCompleted += new UploadStringCompletedEventHandler(web_UploadStringCompleted);
在上面的代码中,图像转换为字节数组,然后到 Base64String 上传。
但在接收端--->
[HttpPost]
public bool SaveImage(string ImageBytes) <---ImageBytes is Null
{
///// some code
}
ImageBytes 参数为空,任何人都可以找出问题所在吗?