问题描述
我正在研究一种方案,其中我将从webapi将文件发布到外部api。为此,我正在使用IFormFile。我想将Suceess消息(正在进行上传)返回到前端,并继续进行后端上传过程,因为这需要1-2分钟。
我正在使用C#.Net,Webapi
任何人都可以帮助我实现这一目标
I am using the below code where i am getting the Error files.OpenReadStream() line
var httpclient = new HttpClient();
var json = JsonConvert.SerializeObject(request);
var content = new MultipartFormDataContent();
content.Headers.ContentType.MediaType = "multipart/form-data";
content.Add(new StreamContent(files.OpenReadStream()),"file",files.FileName);
content.Add(new StringContent(json),"employee_details");
using (var response = await httpclient.PostAsync(_host,content))
{
string apiresponse = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject<SkillDbDTO>(apiresponse);
return result;
}
谢谢 拉姆
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)