i have some troubles with uploading image onto a server
here's the code:
var uploadServer = api.Photo.GetUploadServer(123);
var c = new HttpClient();
var formData = new MultipartFormDataContent();
var requestContent = new MultipartFormDataContent();
var fileContent = new ByteArrayContent(File.ReadAllBytes("images/amogus.jpg"));
fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
{
FileName = "amogus.jpg"
};
formData.Add(fileContent);
var responseFile = Encoding.ASCII.GetString(await c.PostAsync(uploadServer.UploadUrl, formData));
in the first i'm getting a link to upload image there, then i'm adding image to formData and trying to send with PostAync, on this step i have trouble because PostAsync wants uploadUrl to be byte[] but it is a HttpResponseMessage. how do i convert it?
also here is error message:
Argument 1: cannot convert from 'System.Net.Http.HttpResponseMessage' to 'byte[]'
Encoding.ASCII.GetString()'s argument is byte array. But thePostAsync()return theHttpResponseMessage