File upload support to the blogging system

The file upload functionality will be introduced in the Posts section, where we could upload an image against a post. To start with, let's create a File type, which is inherited from IFormFile. It will be used as a base type while uploading the file content to the controller action, the following code implementation would provide support for file upload functionality:

    public class File : IFormFile    {      public Guid Id { get; set; }      public string ContentType { get; set; }      string ContentDisposition { get; set; }      public byte[] Content { get; set; }      [NotMapped]      public IHeaderDictionary Headers { get; set; }      public long Length { get; set; }      public string Name { get; set; } public string FileName { get; set; ...

Get Mastering Entity Framework Core 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.