File upload in ASP.NET Core web API

参考1:File upload in ASP.NET Core web API

https://www.janaks.com.np/file-upload-asp-net-core-web-api/

后台在POST方法中如下(经实验可工作)

[HttpPost]

public IActionResult PostPicture(IFormFile file)

{

  var stream = file.OpenReadStream();//获取流

  var filename=file.File.FileName;// 获取上传的文件名

  //TODO: 其他代码

  return Ok();

}

参考2:ASP.NET Core 2.0 MVC File Upload with MS SQL SERVER FileTable

https://damienbod.com/2015/12/05/asp-net-5-mvc-6-file-upload-with-ms-sql-server-filetable/

posted @ 2017-09-11 17:07  CCJungle  阅读(455)  评论(0编辑  收藏  举报