-2

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

2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Nov 23, 2022 at 11:30
  • Does this answer your question? How to Upload File from Angular to ASP.NET Core Web API Commented Nov 23, 2022 at 13:32

1 Answer 1

1

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();
        }
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.