Tried to use progressMessageHandler
from Net.Http.Handlers
namespace but I got
The type or namespace name 'Handlers' does not exist in the namespace 'System.Net.Http' (are you missing an assembly reference?)
Things I have tried:
Visual studio's Add reference. not working cause unity download System.Net.Http dll and put it to unity dll's not working too
update System.Net.Http from nuget
My current code is:
public static async Task<string> Upload(string uri, string pathFile)
{
byte[] bytes = System.IO.File.ReadAllBytes(pathFile);
using (var content = new ByteArrayContent(bytes))
{
content.Headers.ContentType = new MediaTypeHeaderValue("*/*");
//Send it
var response = await nftClient.PostAsync(uri, content);
response.EnsureSuccessStatusCode();
Stream responseStream = await response.Content.ReadAsStreamAsync();
StreamReader reader = new StreamReader(responseStream);
return reader.ReadToEnd();
}
}