Shefali Lahariya

Shefali Lahariya

  • NA
  • 257
  • 155.7k

how to send filepath empty to server using filestream IN C#

Dec 22 2017 1:58 AM
 Using code this:
but getting error in "
FileStream fs = File.OpenRead(filePath);" /// because file path is empty. so how to call add empty path in form (MultipartFormDataContent).
 
 
MultipartFormDataContent form = new MultipartFormDataContent();
FileStream fs = File.OpenRead(filePath);
var streamContent = new StreamContent(fs);
var imageContent = new ByteArrayContent(streamContent.ReadAsByteArrayAsync().Result);
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(jioMeetConstant.tokentype, " " + jioMeetConstant.Accesstoken);
form.Add(new StringContent(grp_name), "grpName");
form.Add(new StringContent(member), "memberList");
form.Add(imageContent, "grpIcon", Path.GetFileName(filePath));

Answers (1)