文件上传功能添加,注意使用Path.Combine处理通用路径问题(windows||docker)
This commit is contained in:
1 parent
7817c5374c
commit
244b59a3fb
135 files changed
+16937
-75
No files matched your search
@@ -2,6 +2,7 @@
|
||||
using CloudBuilder.Core.Extensions;
|
||||
using CloudBuilder.Core.Service;
|
||||
using CloudBuilder.Security.Data;
|
||||
using CloudBuilder.Security.Policy;
|
||||
using CloudBuilder.Security.Service;
|
||||
using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
@@ -98,13 +99,13 @@ provider.Mappings[".flac"] = "audio/x-flac";
|
||||
provider.Mappings[".m3u8"] = "application/vnd.apple.mpegurl";
|
||||
provider.Mappings[".lrc"] = "application/octet-stream";
|
||||
//虚拟文件,App.Configuration[VirtualPathPolicy.VirtualPath_RealPath]这个路径一定要存在,不然直接出错
|
||||
string physicalDir = app.Configuration["FileServiceSettings:PhysicalFileDirectory"];
|
||||
string physicalDir = app.Configuration[ServiceSettingsPolicy.PhysicalFileDirectory];
|
||||
if (!string.IsNullOrEmpty(physicalDir))
|
||||
{
|
||||
app.UseStaticFiles(new StaticFileOptions()
|
||||
{
|
||||
FileProvider = new PhysicalFileProvider(physicalDir),
|
||||
RequestPath = app.Configuration["FileServiceSettings:RequestPath"],
|
||||
RequestPath = app.Configuration[ServiceSettingsPolicy.RequestPath],
|
||||
ContentTypeProvider = provider
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user