namespace Admin.Core.Common.Files
{
///
/// 文件信息
///
public class FileInfo
{
public FileInfo() { }
///
/// 初始化文件信息
///
/// 文件名称
/// 大小
public FileInfo(string fileName, long size = 0L)
{
FileName = fileName;
Size = new FileSize(size);
Extension = System.IO.Path.GetExtension(FileName)?.TrimStart('.');
}
///
/// 上传路径
///
public string UploadPath { get; set; }
///
/// 请求路径
///
public string RequestPath { get; set; }
///
/// 相对路径
///
public string RelativePath { get; set; }
///
/// 文件名
///
public string FileName { get; set; }
///
/// 保存名
///
public string SaveName { get; set; }
///
/// 文件大小
///
public FileSize Size { get; set; }
///
/// 扩展名
///
public string Extension { get; set; }
///
/// 文件目录
///
public string FileDirectory => System.IO.Path.Combine(UploadPath, RelativePath).ToPath();
///
/// 文件请求路径
///
public string FileRequestPath => System.IO.Path.Combine(RequestPath, RelativePath, SaveName).ToPath();
///
/// 文件相对路径
///
public string FileRelativePath => System.IO.Path.Combine(RelativePath, SaveName).ToPath();
///
/// 文件路径
///
public string FilePath => System.IO.Path.Combine(UploadPath, RelativePath, SaveName).ToPath();
}
}