Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[System.Web.Http.HttpPost]
public async Task<JsonResult> Create()
{
if (!Request.Content.IsMimeMultipartContent())
{
return Error(HttpStatusCode.UnsupportedMediaType,
"Mime type must be multipart");
}
var root = _hostingEnvironmentPathMapper.GetMappedPath("~/App_Data");
var provider = new MultipartFormDataStreamProvider(root);
try
{
await Request.Content.ReadAsMultipartAsync(provider);
// Read multipart form data from the provider and
// do awesome things with it.
}
catch(Exception)
{
// Woes
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.