Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想下载到从 URL 返回的确切文件名。URL 不包含文件名,它会重定向,因此不建议进行字符串操作。
我需要保持相同的文件名和扩展名,就像网络浏览器下载文件一样。
查看响应的标题。将有一个如下所示的标题:
Content-Disposition: attachment; filename="thefilename.ext"