using System;
using System.IO;
namespace Admin.Core.Common.Configs
{
///
/// 上传配置
///
public class UploadConfig
{
///
/// 头像上传配置
///
public FileUploadConfig Avatar { get; set; }
///
/// 文档图片上传配置
///
public FileUploadConfig Document { get; set; }
}
///
/// 文件上传配置
///
public class FileUploadConfig
{
private string _uploadPath;
///
/// 上传路径
///
public string UploadPath
{
get
{
if (_uploadPath.IsNull())
{
_uploadPath = Path.Combine(AppContext.BaseDirectory, "upload").ToPath();
}
if (!Path.IsPathRooted(_uploadPath))
{
_uploadPath = Path.Combine(AppContext.BaseDirectory, _uploadPath).ToPath();
}
return _uploadPath;
}
set => _uploadPath = value;
}
///
/// 请求路径
///
public string RequestPath { get; set; }
///
/// 路径格式
///
public string Format { get; set; }
///
/// 路径日期格式
///
public string DateTimeFormat { get; set; }
///
/// 文件大小 10M = 10 * 1024 * 1024
///
public long MaxSize { get; set; }
///
/// 最大允许上传个数 -1不限制
///
public int Limit { get; set; } = -1;
///
/// 文件格式
///
public string[] ContentType { get; set; }
}
}