在这里,我们尝试识别上传/下载的文件mime-type/content-type。
我们使用下面的方法。下载:
dropBoxClient.Files.DownloadAsync(filePath)上传:
dropBoxClient.Files.UploadAsync(filePath)谢谢你的预付款。
发布于 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; }
https://stackoverflow.com/questions/63128437
复制相似问题