Controllers (Route to actions, File uploads)
Routing
ASP.NET Core MVC is built on top of ASP.NET Core's routing, a powerful URL-mapping component that lets you build applications that have comprehensible and searchable URLs.
Convention-based routing enables you to globally define the URL formats that your application accepts and how each of those formats maps to a specific action method on given controller.
Attribute routing enables you to specify routing information by decorating your controllers and actions with attributes that define your application's routes.
File uploads
To upload small files, you can use a multi-part HTML form or construct a POST request using JavaScript. An example form using Razor, which supports multiple uploaded files, is shown below:
When uploading files using model binding and the IFormFile
interface, the action method can accept either a single IFormFile
or an IEnumerable<IFormFile>
(or List<IFormFile>
) representing several files.
Last updated