public async Task InvokeAsync(HttpContext context, FileUploadOptions options) { string uploadPath = Path.Combine(options.Root, options.Folder); if (!Directory.Exists(uploadPath)) { Directory.CreateDirectory(uploadPath); } // Call the next delegate/middleware in the pipeline await _next(context); }
public static IApplicationBuilder ConfigureFileUpload(this IApplicationBuilder builder, FileUploadOptions options) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (options is null) { throw new ArgumentNullException(nameof(options)); } return(builder.UseMiddleware <ConfigureFileUploadMiddleware>(options)); }