root/trunk/website/forums/attachment.cfm @ 16

Revision 5, 2.6 kB (checked in by DanWilson, 17 years ago)

Initial Commit Of ModelGlue? Website (upgrade to blogcfc 511)

Line 
1<cfsetting enablecfoutputonly=true>
2<!---
3        Name         : attachment.cfm
4        Author       : Raymond Camden
5        Created      : November 3, 2004
6        Last Updated :
7        History      :
8        Purpose          : Load an attachment
9--->
10
11<cfif not isDefined("url.id") or not len(url.id)>
12        <cflocation url="index.cfm" addToken="false">
13</cfif>
14
15<cftry>
16        <cfset message = application.galleon.message.getMessage(url.id)>
17        <cfcatch>
18                <cflocation url="index.cfm" addToken="false">
19        </cfcatch>
20</cftry>
21
22<cfif not len(message.filename)>
23        <cflocation url="index.cfm" addToken="false">
24</cfif>
25
26<cfif not fileExists(application.galleon.settings.attachmentdir & "/" & message.filename)>
27        <cflocation url="index.cfm" addToken="false">
28</cfif>
29
30<cfset extension = listLast(message.filename, ".")>
31
32<cfswitch expression="#extension#">
33
34        <cfcase value="txt">
35                <cfheader name="Content-disposition" value="attachment;filename=#message.filename#">
36                <cfcontent file="#application.galleon.settings.attachmentdir#/#message.filename#" type="text/plain">
37        </cfcase>
38                       
39        <cfcase value="pdf">
40                <cfheader name="Content-disposition" value="attachment;filename=#message.filename#">           
41                <cfcontent file="#application.galleon.settings.attachmentdir#/#message.filename#" type="application/pdf">
42        </cfcase>
43               
44        <cfcase value="doc">
45                <cfheader name="Content-disposition" value="attachment;filename=#message.filename#">           
46                <cfcontent file="#application.galleon.settings.attachmentdir#/#message.filename#" type="application/msword">           
47        </cfcase>
48       
49        <cfcase value="ppt">
50                <cfheader name="Content-disposition" value="attachment;filename=#message.filename#">           
51                <cfcontent file="#application.galleon.settings.attachmentdir#/#message.filename#" type="application/vnd.ms-powerpoint">         
52        </cfcase>
53       
54        <cfcase value="xls">
55                <cfheader name="Content-disposition" value="attachment;filename=#message.filename#">           
56                <cfcontent file="#application.galleon.settings.attachmentdir#/#message.filename#" type="application/application/vnd.ms-excel">         
57        </cfcase>
58
59        <cfcase value="zip">
60                <cfheader name="Content-disposition" value="attachment;filename=#message.filename#">           
61                <cfcontent file="#application.galleon.settings.attachmentdir#/#message.filename#" type="application/application/zip">           
62        </cfcase>
63       
64        <!--- everything else --->
65        <cfdefaultcase>
66                <cfheader name="Content-disposition" value="attachment;filename=#message.filename#">           
67                <cfcontent file="#application.galleon.settings.attachmentdir#/#message.filename#" type="application/unknown">           
68        </cfdefaultcase>
69                       
70</cfswitch>
71
72<cfsetting enablecfoutputonly=false>
Note: See TracBrowser for help on using the browser.