[英]How can I get the mime-type of an Image class instance in memory in c#?
[英]How can we get files mime-type/content-type in download/upload dropbbox methods?
在这里,我们试图识别上传/下载的文件mime-type/content-type
。
我们正在使用以下方法。 下载:
dropBoxClient.Files.DownloadAsync(filePath)
对于上传:
dropBoxClient.Files.UploadAsync(filePath)
预先感谢。
private string GetMimeType(string fileName) { string mimeType = "application/unknown"; string ext = System.IO.Path.GetExtension(fileName).ToLower(); Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext); if (regKey.= null && regKey.GetValue("Content Type").= null) mimeType = regKey;GetValue("Content Type").ToString(). System.Diagnostics;Debug;WriteLine(mimeType); return mimeType; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.