我看过有关如何以编程方式下载文件的示例,但它们都使用直接链接,以 .txt .mp3 .jpg 结尾,等等。但是,我要下载的文件的链接不是直接链接:它不以 .extension 结尾。在这种情况下如何下载文件?
问问题
1228 次
2 回答
0
非常愚蠢的答案:您可以将其作为所有其他文件下载。下载它的方式与使用带有扩展名的 url 相同。
于 2013-10-14T20:28:29.060 回答
0
When downloading over HTTP, the file name is usually set by the server in Content-Disposition header. If that is not present, it is up to the client to choose the file name (based on the URL or some other strategy). The extension can often be derived from the Content-Type response header. See this for some of standard content types http://en.wikipedia.org/wiki/Internet_media_type
于 2013-10-14T19:44:12.423 回答