如何得到正确的文件扩展名,当你知道内容类型 [英] How to get correct file extension when you know content-type
本文介绍了如何得到正确的文件扩展名,当你知道内容类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个文件中的[]包含字节数据。数组可以包含数据为几个不同的文件类型,如XML,JPG,HTML,CSV等。
I have a byte[] containing data for a file. Array can contain data for several different filetypes like xml, jpg, html, csv, etc.
我需要保存在磁盘该文件。
I need to save that file in disk.
我在寻找一个C#代码,找出正确的文件扩展名,当你知道内容类型,但不知道该文件的扩展名?
I'm looking for a c# code to find out proper file extension when you know content-type, but aren't sure for the file extension?
推荐答案
HTTP ://cyotek.com/article/display/mime-types-and-file-extensions 有在 HKEY_CLASSES_ROOT\MIME这样做,主要是查找在注册表中的扩展名的片段\Database\Content Type\< MIME类型>
这篇关于如何得到正确的文件扩展名,当你知道内容类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文