Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 598
Vihaan Verma Avatar asked Aug 18 '12 10:08

Vihaan Verma


People also ask

What type of file type is an MP3?

An mp3 is the most popular type of lossy audio—that is a digital audio file that has been compressed to a manageable size for storage, streaming, and downloads. Smartphones and tablets play mp3 files. The mp3 compression algorithm does result in a loss of quality compared to the original analog audio files.

What is MP3 file content?

MP3 (MPEG-1 Audio Layer-3) is a standard technology and format for compressing a sound sequence into a very small file (about one-twelfth the size of the original file) while preserving the original level of sound quality when it is played. MP3 files (identified with the file name suffix of ".

What is Application force download?

This answer is not useful. Show activity on this post. Content-Type: application/force-download means "I, the web server, am going to lie to you (the browser) about what this file is so that you will not treat it as a PDF/Word Document/MP3/whatever and prompt the user to save the mysterious file to disk instead".


1 Answers

Try "Content-Type: audio/mpeg"

Update

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

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

like image 115
jamjam Avatar answered Sep 21 '22 19:09

jamjam