![](/img/trans.png)
[英]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.