..
Happen in very many instances of having to make documents available to users in a different format from HTML or CFML (which then appear within the browser) such as DOC, XLS, TXT, PDF, or others.
On many occasions, many may not want these documents, depending on the settings on your browser may be opened directly within the browser, but you want the classic download window appears asking you to download the file.
A link to the type
<a href="nomefile.doc"> Download this document in Word format </ a>99%, or at least according to the settings on your browser (but the percentage is still high) is likely to open inside the browser.
If we wanted to prevent this from happening, and then we wanted to force the download of the file, we can use a CFML file and build the link as follows:
<a href="nomefile.cfm"> Download this document in Word format </ a>Nomefile.cfm the file headers that we can use Cold Fusion provides to force the download of Word (or whoever it) by specifying an unknown type of application (with the form application / unknown) and of course with the name and any absolute or relative path of the file to point to.
Here's the code of the file nomefile.cfm
<cfheader name="Content-Disposition" value="inline; filename=nomefile.doc">
<cfcontent type="application/unknown" file="#ExpandPath("nomefile.doc")#">
| |
Excel (Ebook)
Create spreadsheets and calculation. Just 25 €. |
| |
Web Design (Course)
Design Web Sites with HTML, CSS and Dynamic HTML. From 39 €. |
| |
Web Marketing (Course)
Site promotion, search engines and marketing. From 39 €. |