コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }