defdani
defdani

Reputation: 11

Windows Phone 8.1 MultipartFormDataContent is missing

Why can't I use MultipartFormDataContent and StreamContent?
I am getting the following error:

The type or namespace name 'MultipartFormDataContent' could not be found (are you missing a using directive or an assembly reference?)

Here is my code:

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();
                    });

Upvotes: 0

Views: 325

Answers (1)

TheCoolFrood
TheCoolFrood

Reputation: 367

You have to add the System.Net.Http class

using System.Net.Http

Upvotes: 1

Related Questions