Search code examples
http-headersmp3httpresponse

content type for mp3 download response


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".

What would be the right content type for mp3 or audio file download, and am I missing some other headers?


EDIT: The file should automatically start downloading rather than prompting the user for saving it somewhere.


Solution

  • Try "Content-Type: audio/mpeg"

    Update

    To encourage the browser to download the mp3 rather then streaming, do

    Content-Disposition: filename="music.mp3"'