js,通过ajax将文件分片提交
遇到问题:
.net core 6.0 mvc上传文件位置
主文件夹下的\bin\Debug\net6.0
文件访问不了问题
在startup配置
#region 让upload文件夹可以外部访问 string sUploadPath = "/upload"; string sFDir =ToolsBasic.UsPath(sUploadPath); if (!Directory.Exists(sFDir)) { Directory.CreateDirectory(sFDir); } app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(sFDir), RequestPath = sUploadPath }); #endregion
public static string UsPath(string sPath) { //程序集的基目录的文件路径。E:\文件PPT\文件PPT\oneself\SystemProjectOne\SystemProjectOne\SystemProjectOne\bin\Debug\net6.0\ string baseDirectory = AppContext.BaseDirectory; string text = sPath; text = Path.Combine(baseDirectory + sPath); return Path.GetFullPath(text); }
标签:文件,sPath,string,SystemProjectOne,core,js,sFDir,6.0 From: https://www.cnblogs.com/ZhuMeng-Chao/p/17537487.html