How often have you wanted to link to a particular type of file to allow your end user to download the file, only to come to the realization that the file opens up on the user's system instead of allowing a download. Many files do this, such as image files, PDF documents, Word documents, spreadsheets, etc. Even ASP, PHP, ColdFusion source files are a problem because they will execute instead of download to the user. This extension streams the file to the end user as a download instead of opening up on the user's system.
Let's take a look at the interface:
To use the extension, follow these steps:
- Open up a blank page in Dreamweaver (ASP only at this point.)
- Save it. This will be the file you link to.
- Open the extension by choosing Server Behaviors > Tom-Muck.com > Force Download
- Browse to the file you want the user to be able to download. The relative path to the file will be automatically calculated.
- The filename box will fill in automatically, or you can change the final filename to the user.
- Fill in or browse to an error page to redirect to in the event of an error.
- Click OK.
- Now, on any other page where you want a link to appear, link to this ASP file instead.
For example, let's say I have a file named instructions.pdf. When I link directly to the file, it opens up Acrobat Reader on the user's machine instead of being downloadable. I simply create a new file named instructions.asp on my ASP server, point the extension to the instructions.pdf file, apply the extension, and then link to instructions.asp instead of instructions.pdf. The file is now downloadable.
The extension should work in most browsers. Please use the contact form at the bottom of the page to contact me if you find problems with the extension.
The Force Download extension works in Dreamweaver MX and higher in ASP/VBScript and ASP/JScript. The extension is available for free download. For an UltraDev version go to www.basic-ultradev.com/extensions/