var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.MapPost("/fileUp", async (IFormFile file) =>
{
string tempfile = Path.GetTempFileName();
using var stream = File.OpenWrite(tempfile);
await file.CopyToAsync(stream);
});
app.MapPost("/FilesUp", async (IFormFileCollection myFiles) =>
{
foreach (var file in myFiles)
{
string tempfile = Path.GetTempFileName();
using var stream = File.OpenWrite(tempfile);
await file.CopyToAsync(stream);
}
});
app.Run();
Update readme.txt with instructions on testing.
See https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-net-7-preview-1/
Put in https://github.com/dotnet/AspNetCore.Docs.Samples/tree/main/fundamentals/minimal-apis/samples/IFormFile
Update readme.txt with instructions on testing.