[英]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
.在这里,我们试图识别上传/下载的文件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; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.