Uploading Image in Xamarin / c #

1

I'm developing an application on Xamarin that I need to upload image (both Android and IOS) to a server. I looked for something on the internet and could not find it.

I'm using PostAsync of HttpClient .

On the server a WS has been developed that has the following receive structure:

Key                          Value

FotoComprador               Arquivo JPG
FotoVendedor                Arquivo JPG
Localização                 Endereço do Imovel
numero                      numero do imovel
complmento                  complemento do imovel   
CEP                         CEP
Cidade                      Cidade
Estado                      Estado

The Content-type of WS is form-data .

How do I set the contents of the "info" variable to run the code below?

var conteudo = new StringContent(informacoes, Encoding.Unicode, "application/json");
insereCorretor.DefaultRequestHeaders.Add("MoshiWSApiKey", MoshiKey);
insereCorretor.DefaultRequestHeaders.Add("Authorization", String.Format("Basic {0}", autorizacao));
var resultado = await insereCorretor.PostAsync(UrlIncluiRegistro, conteudo);
    
asked by anonymous 17.05.2018 / 04:12

0 answers