【发布时间】:2014-11-26 05:14:06
【问题描述】:
我的下载器代码使用两个文本框:
两个获取用户URL
-
指定驱动器
private void downloadbtn_Click(object sender, EventArgs e) { WebClient myWebClient = new WebClient(); //Declarations for string objects string downloadURL, path; //raw URL taken from user downloadURL = this.downloadURL.Text; path = savePath.Text; Uri tmp = new Uri(downloadURL); string EndPathFileName = tmp.Segments.Last(); path = path + @"\" + EndPathFileName; //downloads file using async method myWebClient.DownloadFileAsync(tmp, savePath.Text); }
当我使用以下类型的 URL 时会出现问题: http://www.dailymotion.com/video/x1coxfe_aryan-khan-tera-pyar-official-music-video-hd_music 没有任何后缀,即 mp3、mp4 等。 与具有 *.mp3/4 等的 url 相比,它在这里下载了一个零数据的图标
大家有什么建议
【问题讨论】:
-
在这些情况下,您需要检查
Content-Type标头中的 mime 类型,请参阅 stackoverflow.com/questions/5904308/…
标签: c#