IForm post /2

pull/221/head
Rick Anderson 2023-10-11 14:44:40 -10:00
parent bd331c43d4
commit 49de15fef5
3 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,23 @@
using Microsoft.AspNetCore.Mvc;
var builder = WebApplication.CreateBuilder();
builder.Services.AddAntiforgery();
var app = builder.Build();
//app.UseAntiforgery();
app.MapPost("/upload", ([FromForm] DocumentUpload document) =>
{
return Results.Ok();
});
app.Run();
public class DocumentUpload
{
public string Name { get; set; } = "Uploaded Document";
public string? Description { get; set; }
public IFormFile? Document { get; set; }
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}