Seriously i search a lot upload file from WP8 to server. it's doesn't work :(
Why i get this error?? it's the error is because my FileuploadUrl?
System.Net.Http.HttpRequestException: Response status code does not indicate success: 405 (Method Not Allowed)
private async void UploadFile()
{
try
{
if (photoStream != null)
{
//var fileUploadUrl = @"http://<IPaddress>:<port>/fileupload";
var fileUploadUrl = @"http://www.comevox.com:80/services";
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();
});
}
btnUpload.IsEnabled = false;
imgSelectedImage.Source = null;
txtMessage.Visibility = Visibility.Visible;
}
catch
{
txtError.Visibility = Visibility.Visible;
}
}
}