简体   繁体   中英

How can we get files mime-type/content-type in download/upload dropbbox methods?

Here we are trying to identifying uploaded/downloaded files mime-type/content-type .

We are using below methods. For downloading:

dropBoxClient.Files.DownloadAsync(filePath)

For uploading:

dropBoxClient.Files.UploadAsync(filePath)

Thanks in an advance.

 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; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM