如何将图像从Angular(2/4)传递到ASP.NET Core WebAPI服务器文件夹中

时间:2017-09-04 13:34:07

标签: angular file-upload asp.net-core asp.net-apicontroller

我的文件在Angular end中采用以下格式:

let fi = this.fileInput.nativeElement;
let fileToUpload = fi.files[0];

let input = new FormData();
input.append("file", fileToUpload);

return this.http.post(uploadUrl, input);

我在ASP.NET CORE中的API是:

[HttpPost]
public IActionResult Post([FromBody]JObject objData)
{
    dynamic jsonData = objData;
    JObject FileJson = jsonData.jsonFile; // JSON File

    // Please suggest how to store the file in Folder
}

提前致谢

0 个答案:

没有答案