Handling multipart requests with JSON and file uploads in ASP.NET Core

added by DotNetKicks
9/4/2018 9:59:17 AM

2 Kicks, 251 Views

Suppose we're writing an API for a blog. Our "create post" endpoint should receive the title, body, tags and an image to display at the top of the post. This raises a question: how do we send the image? There are at least 3 options: Embed the image bytes as base64 in the JSON payload, e.g.