Nuno_147
Nuno_147

Reputation: 2913

Making sure the browser will download a file and not open it

I have an mp3 files on my site and I wish that when a user click on them they will get downloadeded.

Current behiavor is that the file is getting opened by the broweser mp3 player. I assume its relates to the mime-type but dont know what I should do to fix it.

My mp3 files are located on S3 so can not change the response header.

Upvotes: 1

Views: 523

Answers (1)

Mr Lister
Mr Lister

Reputation: 46579

One way is to have the mp3 files be attachments by giving them a content-disposition http header.

This site explains how to give custom http headers to files on an AWS system.

Upvotes: 1

Related Questions