https://github.com/simplifynet/simplify.web.multipart
Simplify.Web multipart form model binder
https://github.com/simplifynet/simplify.web.multipart
dot-net dot-net-core multipart multipart-data simplify simplify-web
Last synced: 3 days ago
JSON representation
Simplify.Web multipart form model binder
- Host: GitHub
- URL: https://github.com/simplifynet/simplify.web.multipart
- Owner: SimplifyNet
- License: lgpl-3.0
- Created: 2019-09-15T04:52:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-12-15T06:20:29.000Z (about 1 year ago)
- Last Synced: 2025-04-02T17:11:19.959Z (11 months ago)
- Topics: dot-net, dot-net-core, multipart, multipart-data, simplify, simplify-web
- Language: C#
- Size: 3.98 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Simplify.Web.Multipart
[](https://www.nuget.org/packages/Simplify.Web.Multipart/)
[](https://www.nuget.org/packages/Simplify.Web.Multipart/)
[](https://github.com/SimplifyNet/Simplify.Web.Multipart/actions/workflows/build.yml)
[](https://libraries.io/nuget/Simplify.Web.Multipart)
[](https://www.codefactor.io/repository/github/simplifynet/simplify.web.Multipart)

[Simplify.Web.Multipart](https://www.nuget.org/packages/Simplify.Web.Multipart/) is a package which provides multipart form view model and model binder for [Simplify.Web](https://github.com/SimplifyNet/Simplify.Web) web-framework.
## Quick start
### Registering binder
```csharp
public void Configuration(IApplicationBuilder app)
{
// ...existing code...
HttpModelHandler.RegisterModelBinder();
// ...existing code...
app.UseSimplifyWeb();
}
public void ConfigureServices(IServiceCollection services)
{
// ...existing code...
DIContainer.Current.RegisterHttpMultipartFormModelBinder();
// ...existing code...
}
```
### Getting files from client
#### Asynchronous
```csharp
public class MyController : ControllerAsync
{
public override async Task Invoke()
{
await ReadModelAsync();
Model.Files;
}
}
```
#### Synchronous
Multipart files will be deserialized to the controller model on first model access
```csharp
public class MyController : Controller
{
public override ControllerResponse Invoke()
{
Model.Files;
}
}
```