【发布时间】:2020-04-19 22:29:15
【问题描述】:
我有问题。我想将图像上传到网页,以便可以将其存储在我的服务器上。现在我可以找到很多将文件上传到服务器的示例,但是图片呢?
我已经尝试创建图像的字节数组并将其作为 POST 发送,但在以下行崩溃,说明 URI 太长:
var postData = new List<KeyValuePair<string, string>>();
postData.Add(new KeyValuePair<string, string>("id", App.User.Id.ToString()));
postData.Add(new KeyValuePair<string, string>("image", ByteArray));
var content = new FormUrlEncodedContent(postData);
还有其他方法吗?
【问题讨论】:
标签: c# xamarin xamarin.forms httpwebrequest httpclient