|
How to publish files for download:
Sometimes you need to put certain files on your web site, that can not normally be handled by a web browser, or you want to give your visitors an opportunity to just download them.
- The easiest way to do that is to server the file out with a MIME type, that would most probably ask user what to do with the file, such as application/octet-stream.
- In order to do that, you need to override default MIME type, the web server considers appropriate for the files with a given extension.
- Let's say you are distributing the files with a
.foo extension, that are understood by your users' Microsoft® Foo™ 1.0 program. In the directory, where you keep your .foo files, create a file, called .htacess, and add one line to it:
Addtype application/octet-stream .foo
- If not only
.foo, but also .bar files need to be downloaded, the line above will look like this:
Addtype application/octet-stream .foo .bar
- Then you can just reference a
.foo file from your HTML script, for instance like this:
<a href="file.foo">Click here to download file.foo!</a>
- If that directory is password-protected, or you already have an
.htaccess file there, for whatever reason, it is safe to just add the AddType command to the existing file.
Please see Apache web server documentation for additional information.
Please contact support@binary.net if you have any further questions.
|