繁体   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