commit
845bc50899
|
@ -1,6 +1,3 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using System.IO;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var app = builder.Build();
|
||||
|
||||
|
@ -8,7 +5,8 @@ app.MapGet("/", () => "Hello World!");
|
|||
|
||||
app.MapPost("/upload", async (IFormFile file) =>
|
||||
{
|
||||
var tempFile = Path.GetTempFileName(); // or an existing custom file path
|
||||
var tempFile = Path.GetTempFileName();
|
||||
app.Logger.LogInformation(tempFile);
|
||||
using var stream = File.OpenWrite(tempFile);
|
||||
await file.CopyToAsync(stream);
|
||||
});
|
||||
|
@ -17,7 +15,8 @@ app.MapPost("/upload_many", async (IFormFileCollection myFiles) =>
|
|||
{
|
||||
foreach (var file in myFiles)
|
||||
{
|
||||
var tempFile = Path.GetTempFileName(); // or an existing custom file path
|
||||
var tempFile = Path.GetTempFileName();
|
||||
app.Logger.LogInformation(tempFile);
|
||||
using var stream = File.OpenWrite(tempFile);
|
||||
await file.CopyToAsync(stream);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue