I would like to send file to a web service with other parametrs
Like this :
param1=value1¶m2=value2¶m3=IMAGE_FILE
how can i do this in C#
I try this :
¶m3=Convert.ToBase64String(File.ReadAllBytes(txtlogo.Text))
but thats not work..
so have any solution ?
Update :
Also I try to use from HttpContent
like this (i don't know it's correct or no )
HttpContent stringContent = new StringContent("param1=param1¶m2=param2");
FileStream file = new FileStream(txtlogo.Text, FileMode.Open);
HttpContent fileStreamContent = new StreamContent(file);
using (var client = new HttpClient())
using (var formData = new MultipartFormDataContent())
{
formData.Add(stringContent, "param1", "param1");
formData.Add(fileStreamContent, "file1", "file1");
var response = client.PostAsync("url", formData).Result;
if (!response.IsSuccessStatusCode)
{
string ss = "s";
}
string my = response.Content.ReadAsStringAsync().Result;
}
and server don't receive any data with POST
...