Image Upload in Xamarin / c#

Asked

Viewed 148 times

1

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

I’m using the PostAsync of HttpClient.

On the server a WS which has the following receiving 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 should I set the contents of the variable "information" to execute 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);
  • What is the technology of your backend (Ws)?

  • C#. Already developed and working.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.