Compare commits
3 Commits
9cfe5cbb84
...
d951ea5857
| Author | SHA1 | Date | |
|---|---|---|---|
| d951ea5857 | |||
|
|
16ca1b28fc | ||
|
|
b6a2afdc66 |
@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Serilog;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Serilog.Sinks.MariaDB.Extensions;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@ -159,10 +160,15 @@ app.Use(async (context, next) =>
|
||||
});
|
||||
*/
|
||||
|
||||
var uploadsPath = Path.Combine(Directory.GetCurrentDirectory(), "uploads");
|
||||
if (!Directory.Exists(uploadsPath))
|
||||
{
|
||||
Directory.CreateDirectory(uploadsPath); // 如果目录不存在,创建它
|
||||
}
|
||||
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
FileProvider = new PhysicalFileProvider(
|
||||
Path.Combine(Directory.GetCurrentDirectory(), "uploads")),
|
||||
FileProvider = new PhysicalFileProvider(uploadsPath),
|
||||
RequestPath = "/uploads"
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user