mirror of
https://github.com/CoreUnion/CoreShop.git
synced 2026-10-29 05:26:37 +08:00
修复自定义上传路径上传至站点根目录,而非wwwroot的问题 #I41TD1
This commit is contained in:
@@ -175,7 +175,7 @@ namespace CoreCms.Net.Configuration
|
||||
|
||||
//附件存储
|
||||
di.Add(SystemSettingConstVars.FilesStorageType, new DictionaryKeyValues() { sKey = "存储方式", sValue = "LocalStorage" });
|
||||
di.Add(SystemSettingConstVars.FilesStoragePath, new DictionaryKeyValues() { sKey = "存储路径", sValue = "Upload" });
|
||||
di.Add(SystemSettingConstVars.FilesStoragePath, new DictionaryKeyValues() { sKey = "存储路径", sValue = "/upload/" });
|
||||
di.Add(SystemSettingConstVars.FilesStorageFileSuffix, new DictionaryKeyValues() { sKey = "文件后缀类型", sValue = "gif,jpg,jpeg,png,bmp,xls,xlsx,doc,pdf,mp4,WebM,Ogv" });
|
||||
di.Add(SystemSettingConstVars.FilesStorageFileMaxSize, new DictionaryKeyValues() { sKey = "文件最大大小", sValue = "10" });
|
||||
di.Add(SystemSettingConstVars.FilesStorageBucketBindUrl, new DictionaryKeyValues() { sKey = "云存储绑定域名", sValue = "https://www.corecms.net/" });
|
||||
|
||||
@@ -424,7 +424,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
var md5 = OssUtils.ComputeContentMd5(fileStream, file.Length);
|
||||
|
||||
var filePath = _filesStorageOptions.Path + today + "/" + newFileName; //云文件保存路径
|
||||
//初始化阿里云配置--外网Endpoint、访问ID、访问password
|
||||
//初始化阿里云配置--外网Endpoint、访问ID、访问password
|
||||
var aliyun = new OssClient(_filesStorageOptions.Endpoint, _filesStorageOptions.AccessKeyId, _filesStorageOptions.AccessKeySecret);
|
||||
//将文件md5值赋值给meat头信息,服务器验证文件MD5
|
||||
var objectMeta = new ObjectMetadata
|
||||
@@ -522,7 +522,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
|
||||
if (_filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.LocalStorage.ToString())
|
||||
{
|
||||
var saveUrl = "/Upload/" + today + "/";
|
||||
var saveUrl = _filesStorageOptions.Path + today + "/";
|
||||
var dirPath = _webHostEnvironment.WebRootPath + saveUrl;
|
||||
string bucketBindDomain = AppSettingsConstVars.AppConfigAppUrl;
|
||||
|
||||
@@ -554,7 +554,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
var md5 = OssUtils.ComputeContentMd5(fileStream, memStream.Length);
|
||||
|
||||
var filePath = _filesStorageOptions.Path + today + "/" + newFileName; //云文件保存路径
|
||||
//初始化阿里云配置--外网Endpoint、访问ID、访问password
|
||||
//初始化阿里云配置--外网Endpoint、访问ID、访问password
|
||||
var aliyun = new OssClient(_filesStorageOptions.Endpoint, _filesStorageOptions.AccessKeyId, _filesStorageOptions.AccessKeySecret);
|
||||
//将文件md5值赋值给meat头信息,服务器验证文件MD5
|
||||
var objectMeta = new ObjectMetadata
|
||||
@@ -608,6 +608,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
src = _filesStorageOptions.BucketBindUrl + filePath
|
||||
};
|
||||
}
|
||||
jm.otherData = _filesStorageOptions;
|
||||
|
||||
|
||||
return Json(jm);
|
||||
@@ -688,7 +689,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
var md5 = OssUtils.ComputeContentMd5(fileStream, file.Length);
|
||||
|
||||
var filePath = _filesStorageOptions.Path + today + "/" + newFileName; //云文件保存路径
|
||||
//初始化阿里云配置--外网Endpoint、访问ID、访问password
|
||||
//初始化阿里云配置--外网Endpoint、访问ID、访问password
|
||||
var aliyun = new OssClient(_filesStorageOptions.Endpoint, _filesStorageOptions.AccessKeyId, _filesStorageOptions.AccessKeySecret);
|
||||
//将文件md5值赋值给meat头信息,服务器验证文件MD5
|
||||
var objectMeta = new ObjectMetadata
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 998 B |
Binary file not shown.
|
Before Width: | Height: | Size: 447 KiB |
@@ -538,7 +538,7 @@
|
||||
<div class="layui-input-inline layui-inline-10">
|
||||
<input type="text" name="filesStoragePath" value="{{d.data.configs['filesStoragePath']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">请使用路径,如"upload/doc/"</div>
|
||||
<div class="layui-form-mid layui-word-aux">请使用路径,如"/upload/doc/",路径前后都要加“/”</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
|
||||
if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.LocalStorage.ToString())
|
||||
{
|
||||
string saveUrl = "/upload/" + today + "/";
|
||||
string saveUrl = filesStorageOptions.Path + today + "/";
|
||||
string dirPath = _webHostEnvironment.WebRootPath + saveUrl;
|
||||
if (!Directory.Exists(dirPath))
|
||||
{
|
||||
@@ -333,7 +333,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
string md5 = OssUtils.ComputeContentMd5(fileStream, file.Length);
|
||||
|
||||
string filePath = filesStorageOptions.Path + today + "/" + newFileName;//云文件保存路径
|
||||
//初始化阿里云配置--外网Endpoint、访问ID、访问password
|
||||
//初始化阿里云配置--外网Endpoint、访问ID、访问password
|
||||
var aliyun = new OssClient(filesStorageOptions.Endpoint, filesStorageOptions.AccessKeyId, filesStorageOptions.AccessKeySecret);
|
||||
//将文件md5值赋值给meat头信息,服务器验证文件MD5
|
||||
var objectMeta = new ObjectMetadata
|
||||
|
||||
Reference in New Issue
Block a user