m.qayyum
m.qayyum

Reputation: 418

how to force file download instead of opening in any application

I want to prompt users to save file instead of opening file in application. For example if user click a mp3 file link....mp3 file must not be open in win media player...instead user promoted to download that file.

Upvotes: 0

Views: 1752

Answers (2)

David
David

Reputation: 218837

Set the Content-Disposition header to attachment; filename=filename.mp3. This will suggest to the browser that it should prompt the user to save as the given file name.

Upvotes: 2

Kyle d'Oliveira
Kyle d'Oliveira

Reputation: 6382

I believe you can just send a content-disposition header. I.e.

Content-Disposition: attachment; filename=<file name.ext> 

And that should force the option to download the file.

Upvotes: 0

Related Questions