mp3 下载响应的内容类型 [英] content type for mp3 download response
问题描述
我创建了一个简单的 HTTP 服务器,允许用户下载文件.但这似乎不适用于 mp3 文件.当前的内容类型是"application/misc"
.为了使它适用于 mp3 文件,我尝试了 "application/mp3"
、 "application/data"
和 "application/mpeg"代码>.
I have created a simple HTTP server which allows users to download files. But this does not seem to work for mp3 files. The content type currently is "application/misc"
. In order to make it work with mp3 files , I've tried "application/mp3"
, "application/data"
and "application/mpeg"
.
什么是 mp3 或音频文件下载的正确内容类型,我是否缺少其他一些标题?
What would be the right content type for mp3 or audio file download, and am I missing some other headers?
文件应自动开始下载,而不是提示用户将其保存在某处.
The file should automatically start downloading rather than prompting the user for saving it somewhere.
推荐答案
试试"Content-Type: audio/mpeg"
更新
为了鼓励浏览器下载 mp3 而不是流式传输,请这样做
To encourage the browser to download the mp3 rather then streaming, do
内容配置:filename="music.mp3"'
Content-Disposition: filename="music.mp3"'
这篇关于mp3 下载响应的内容类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!