using Elsa.Http.Abstractions; using Elsa.Http.Contexts; using Microsoft.AspNetCore.Http; namespace Elsa.Http.DownloadableContentHandlers; /// /// Handles content that represents a downloadable stream. /// public class FormFileDownloadableContentHandler : DownloadableContentHandlerBase { /// public override bool GetSupportsContent(object content) => content is IFormFile; /// protected override Downloadable GetDownloadable(DownloadableContext context) { var file = (IFormFile)context.Content; var stream = file.OpenReadStream(); var fileName = Path.GetFileName(file.FileName); var contentType = file.ContentType; return new Downloadable(stream, fileName, contentType); } }