I need to use the FilegetMimeType() function, and I tested it in a program called demomimetype.cfm.
<cfoutput>
<cfset reploc = '#cookie.moxlog#'>
<cfset extrepoc = ExpandPath('#reploc#')>
<cfset typegif = FilegetMimeType('#extrepoc#/brightpink1.gif')>
typegif brightpink1.gif #typegif#<br>
</cfoutput>
This program returns the result that typegif is "image/gif" which is exactly correct. When I add the lines
<cfheader name = "Content-Disposition" value="attachment;#extrepoc#/logo106">
<cfcontent type="#typegif#" file="#extrepoc#/brightpink1.gif">
I get this result:
This is what I was hoping for, although demomimetype.cfm is not what I chose to open. However, this screen does open brightpink1.gif, so I'm okay with it.
Then I tried to integrate this into my actual system using this program, which results from a submit in an earlier program:
<cfoutput>
<cfset col = form.thecol>
<cfset colarray = getPageContext().getRequest().getParameterValues('xcol')>
<cfset origval = getPageContext().getRequest().getParameterValues('#col#')>
<cfset attname = origval[1]>
<cfset extreploc = ExpandPath("#cookie.moxlog#")>
<cfset typeatt = FilegetMimeType('#extreploc#/#attname#')>
</cfoutput>
The variable "attname" will be "brightpink1.gif. When I output typeatt I get "application/octet-stream", which is not correct. And when I add the lines
<cfheader name = "Content-Disposition" value="attachment;#extreploc#/#attname#">
<cfcontent type="#typeatt#" file="#extreploc#/#attname#">
I get the wrong result -- not surprising because the mimetype is wrong:

Obviously the demo is working correctly, and the real application is not. I have tried making the filename in the demo to be a variable, and the demo goes on working. I have tried making the filename in the application specific, and it still does not work.
I don't want to use the "strict" parameter because some of the files do not have extensions, even though they are of a specific type like .jpg.
There must be some reason why the code in the demo works and the nearly identical code in the application does not. But I cannot see it. Can anyone figure out what is going on here?
