This commit is contained in:
Alexander
2022-12-24 12:15:13 +03:00
parent a0e10c2781
commit 2ea36fe8a0
2 changed files with 15 additions and 3 deletions

View File

@@ -66,4 +66,16 @@ public static class FileExtension
/// <returns>MIME-тип файла</returns>
public static string MIMEType (IFormFile file) =>
file.ContentType;
/// <summary>
/// Размер файла в байтах
/// </summary>
/// <param name="fileName">Полное имя и путь к файлу</param>
/// <returns>Размер файла в байтах</returns>
public static long FileSize(string fileName)
{
FileInfo fileInfo = new (fileName);
return fileInfo.Length;
}
}