Tips & Tricks

Force downloading of a file instead of display

If you have files on your server that are being displayed instead of prompting for download you can fix it very easy.

Such example is the .jad files. If you have default installation of apache without additional mime types it’s going to display the .jad file in your browser instead of prompting for download. The easiest way to correct this is creating .htaccess file where you can put a simple line:

AddType unknown/nothing .jad

Once this is done you can simply refresh your browser and click on the link again. It will prompt you for download. Of course if you want other kind of files to be prompted for download you can change the extension. For example if you need .pdf to be prompted for download you can change the type like this:

AddType unknown/nothing .pdf

You can have multiple file extensions set:

AddType unknown/nothing .pdf .jad

You just need to separate them with spaces.

Good Luck!

Leave a Reply