Created
July 1, 2022 11:49
-
-
Save DalSoft/ef86083643ea7b0bf253034855041dad to your computer and use it in GitHub Desktop.
GetMimeTypeForFileExtension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static string GetMimeTypeForFileExtension(string filePath) | |
{ | |
const string defaultContentType = "application/octet-stream"; | |
if (!new FileExtensionContentTypeProvider().TryGetContentType(filePath, out string contentType)) | |
{ | |
contentType = defaultContentType; | |
} | |
return contentType; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment