.net core 獲取檔案MIME型別

Hey,Coder!發表於2024-07-08
FileExtensionContentTypeProvider provider = new FileExtensionContentTypeProvider();
if (!provider.TryGetContentType(inDto.ObjectName, out string contentType))
{
    throw new NotImplementedException("未知的檔案型別:" + inDto.ObjectName);
}

相關文章