Serving Data Files From A Web Directory

From HE FAQ
Jump to: navigation, search

To make your files download automatically, place them in a directory with a .htaccess file containing the following:

AddType application/octet-stream FileExtension

Replace where it says "FileExtension" with extention of the kind of file you'd like be downloaded automatically. You can create a new line for each type of file. For instance if you'd like all the .gif files and .jpg files to automatically download, instead of simply viewed in the webpage, then your .htaccess file would have the following two lines in it:

AddType application/octet-stream gif
AddType application/octet-stream jpg

This is most commonly used to force automatic download of files that some browsers might try to open up in-page.