在一个 HTTP 请求中下载多个文件

2022-01-02 00:00:00 http download php

如何在一个 HTTP 请求中下载多个文件?我的意思是,当您有多个附件并且您选择要下载的内容然后按下载时,它们将被自动下载,而您不必手动单击每个附件.

how is it possible to download multiple files in one HTTP request? what i mean it's like when you have multiple attachments and you select what you want to download then press download so they will be automaticcaly downloaded and you don't have to click on each one manually.

我使用 PHP 作为服务器端 srcipting.

i'm using PHP as a serverside srcipting.

推荐答案

是可以发送HTTP 中的多部分响应:

通常,HTTP 将多部分消息体视为与任何其他媒体类型没有什么不同:严格视为有效负载.[…] HTTP 用户代理应该遵循与 MIME 用户代理在收到多部分类型时相同或相似的行为.

In general, HTTP treats a multipart message-body no differently than any other media type: strictly as payload. […] an HTTP user agent SHOULD follow the same or similar behavior as a MIME user agent would upon receipt of a multipart type.

[…] 如果应用程序接收到无法识别的多部分子类型,应用程序必须将其视为等同于多部分/混合".

[…] If an application receives an unrecognized multipart subtype, the application MUST treat it as being equivalent to "multipart/mixed".

但由于 Firefox 是我所知道的唯一支持这种多部分响应的浏览器(除了multipart/byterange),为此您应该使用一些存档文件格式.

But since Firefox is the only browser that I know about to support such multipart responses (apart from multipart/byterange), you should use some archive file format for this purpose.

相关文章