首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我们如何在下载/上传dropbbox方法中获取文件的mime-type/content-type?

我们如何在下载/上传dropbbox方法中获取文件的mime-type/content-type?
EN

Stack Overflow用户
提问于 2020-07-28 14:46:35
回答 1查看 86关注 0票数 0

在这里,我们尝试识别上传/下载的文件mime-type/content-type

我们使用下面的方法。下载:

代码语言:javascript
复制
dropBoxClient.Files.DownloadAsync(filePath)

上传:

代码语言:javascript
复制
dropBoxClient.Files.UploadAsync(filePath)

谢谢你的预付款。

EN

回答 1

Stack Overflow用户

发布于 2020-07-28 15:49:07

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63128437

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档