Skip to content
 
 

Repository files navigation

https://www.nuget.org/packages/Stio.JsonMultipartFormDataSupport

JsonMultipartFormDataSupport

Morasiu's project is taken as a basis.
The main difference from the original source is reading the json body from Request.Form.Files.

Usage

  1. Simple add this to your ConfigureServices
services.AddJsonMultipartFormDataSupport(JsonSerializerChoice.SystemText);
  1. Create your wrapper
public class MyWrapper
{
    [Required]
    public IFormFile File { get; set; } = null!;

    [FromJson, Required]
    public MyJson Json { get; set; } = null!;
}

and then add to your controller

[HttpPost]
public IActionResult Post([FromForm] MyWrapper request)
{
    return this.Ok();
}

About

Adds support for json in multipart/form-data requests.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages