0
我正在開發一個應用程序在Windows Phone 8.1的C#,可以拍照併發送到一個服務器(在base64)與發佈請求。如何發送一個圖像base64到服務器的Windows Phone 8.1
所以我的問題是,我找不到一種方法,仍然適用於我的請求包含我的圖像base64在身體上,並將其發送到我的服務器。
private async void validPicture_Click(object sender, RoutedEventArgs e)
{
Encode("ms-appx:///xx/xxx.jpg");
try
{
var client = new Windows.Web.Http.HttpClient();
var uri = new Uri("http://x.x.x.x:x/picture/");
string pathBase64 = Encode("ms-appx:///xx/xxx.jpg").ToString();
Dictionary<string, string> pairs = new Dictionary<string, string>();
pairs.Add("type", "recognition");
HttpFormUrlEncodedContent formContent = new HttpFormUrlEncodedContent(pairs);
Windows.Web.Http.HttpResponseMessage response = await client.PostAsync(uri, formContent);
string content = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode)
{
}
}
catch (Exception eu)
{
}
}
如果你是一個問題或需要更多的信息,請告訴我。
謝謝你的時間。