How to Upload File from Angular to ASP.NET Core Web API
I wanted to know how to write it's controller part can anyone help me in that?
What to right inside controller
Angular simple example: https://codesandbox.io/s/jolly-montalcini-49h53n?file=/src/app/app.component.html Look App Folder
Web Api Controller: Object Rq:
public class UploadFileRq
{
public IFormFile File { get; set; }
}
Controller:
[HttpPut("yourUrl")]
public async Task<IActionResult> UploadFile([FromForm] UploadFileRq file)
{
// your process here
return Ok();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.