HttpClient upload report with PostAsync

LucculLuccul FRMember ✭✭


I created my own version of my imgur uploader. And now, i want to get my upload progress. I can use ModernHttpClient if you want, because i have small difficulties to make my progress report.

This is my code:

using (var client = new HttpClient(new NativeMessageHandler()))

    var base64Image = ImageToBase64(imageStream);

    var response = await client.PostAsync(new Uri(BaseUrl + "image"), new StringContent(base64Image));

    if (response.IsSuccessStatusCode)
        var content = await response.Content.ReadAsStringAsync();

        var imageObj = JsonConvert.DeserializeObject<ImgurRootObject<ImgurModel>>(content);

        return imageObj.Data;

    return null;

Thank you for your help.


Sign In or Register to comment.