Windows Phone 8.1 缺少 MultipartFormDataContent
Windows Phone 8.1 MultipartFormDataContent is missing
为什么我不能使用 MultipartFormDataContent
和 StreamContent
?
我收到以下错误:
The type or namespace name 'MultipartFormDataContent' could not be found (are you missing a using directive or an assembly reference?)
这是我的代码:
var fileUploadUrl = @"http://<IPaddress>:<port>/fileupload";
var client = new HttpClient();
photoStream.Position = 0;
MultipartFormDataContent content = new MultipartFormDataContent();
content.Add(new StreamContent(photoStream), "file", fileName);
await client.PostAsync(fileUploadUrl, content)
.ContinueWith((postTask) =>
{
postTask.Result.EnsureSuccessStatusCode();
});
你必须 add System.Net.Http class
using System.Net.Http
为什么我不能使用 MultipartFormDataContent
和 StreamContent
?
我收到以下错误:
The type or namespace name 'MultipartFormDataContent' could not be found (are you missing a using directive or an assembly reference?)
这是我的代码:
var fileUploadUrl = @"http://<IPaddress>:<port>/fileupload";
var client = new HttpClient();
photoStream.Position = 0;
MultipartFormDataContent content = new MultipartFormDataContent();
content.Add(new StreamContent(photoStream), "file", fileName);
await client.PostAsync(fileUploadUrl, content)
.ContinueWith((postTask) =>
{
postTask.Result.EnsureSuccessStatusCode();
});
你必须 add System.Net.Http class
using System.Net.Http