title: .NET Core 2: How to check if the request is MIME multipart Content?
body: <p>In ASp.NET MVC, you can check if the current request is MIME multipart content. How to check that in .NET Core? I have an action filter to validate that, but not sure how to evaluate to request header. IsMimeMultipartContent is not available in .NET Core.</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Checks whether the current request specified content is MIME multipart content.
  /// &lt;/summary&gt;
  /// &lt;exception cref="HttpRequestException"&gt;Raised when the current request doesn't have MIME multipart content.&lt;/exception&gt;
  public class HasMimeMultipartContentAttribute : ActionFilterAttribute
  {
      public override void OnResultExecuting(ResultExecutingContext context)
      {
          if (!context.HttpContext.Request.Headers.IsMimeMultipartContent())
              throw new HttpRequestException("This request does not contain any file to upload.");
      }
  }
  </code></pre>