簡體   English   中英

我們如何在下載/上傳 dropbbox 方法中獲取文件 mime-type/content-type?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM