> rtf = application/rtf
> pdf = application/pdf
> txt = text/plain
These are just 'mime' types. A quick Google search would find
documentation of any and every type you could ever care to use.
> 2. No. Once an HTTP redirect is sent, processing on that page stops.
Yes, a user who did not allow a relocation would just receive notice
that a relocation request was sent, what would they like to do about it.
They have noway to access the page relocated from.
P.S. If you want clean downloads using the <cfcontent...> method there
are some headers you would probably want to set as well to inform the
browser the proper file name and extension of the download. This is
well discussed and blogged all over the internet and full examples are
plentiful.
Kronin555 - 24 Jun 2008 23:12 GMT
> P.S. If you want clean downloads using the <cfcontent...> method there
are some headers you would probably want to set as well to inform the
browser the proper file name and extension of the download. This is
well discussed and blogged all over the internet and full examples are
plentiful.
Ian, do you mean like the <cfheader...> tag I posted in my original reply?
<cfheader name="Content-Disposition" value="inline; filename=document.doc">
The full code I use to push files to users is as follows:
<cfparam name="filename">
<cfset fileshareroot="/my/fileshare/root">
<!--- verify user can access this file. --->
<cfset validAccess = false>
<cfif userCanAccess> <!--- must be customized --->
<cfset validAccess = true>
</cfif>
<cfif not validAccess>
You are not authorized to view this document.
<cfabort>
</cfif>
<!--- verify document exists --->
<cfif not FileExists("#FileshareRoot#/#filename#")>
The document you requested doesn't exist.
<cfabort>
</cfif>
<!---
// getContentTypeFor() uses mime types from
// JAVA_HOME/lib/content-types.properties or
// JAVA_HOME/jre/lib/content-types.properties
--->
<cfset URLConnection = CreateObject("Java","java.net.URLConnection")>
<cfset myMimeType = URLConnection.getFileNameMap().getContentTypeFor(filename)>
<!--- if the file extension isn't found in
JAVA_HOME/jre/lib/content-types.properties, then myMimeType isn't defined. Set
it to text/plain --->
<cfif not isDefined("myMimeType")><cfset myMimeType = "text/plain"></cfif>
<cfheader name="Content-Disposition" value='inline; filename="#filename#"'>
<cfcontent type="#myMimeType#" deletefile="No"
file="#FileshareRoot#/#filename#">
Ian Skinner - 24 Jun 2008 23:21 GMT
Yes those are fine examples that I forgot you posted.