I belive the logic for adding the mime type header to the "download file" functionality is reversed in the ColdFusion version of CKFinder 2.0
The original code snippet is this:
... which results in images and so forth being rendered to the screen in binary unless the format parameter is sent in the URL and it doesn't have the value "text". Since the format parameter is never sent at all (that I can see) this results in the error. Oddly this behaviour isn't present on the live demo, which leads me to wonder if the demo was patched already?
When the logic is reversed to this it works as expected (the file is downloaded unless the "format=text" parameter is sent in the URL.
full CFC attached.
The original code snippet is this:
<cfif structkeyexists(URL, "format") and URL.format neq "text"> <cfheader name="Content-Disposition" value="attachment; filename=#fileName#"> <cfcontent type="application/octet-stream" file="#filePath#" /> <cfelse> <cfcontent type="text/plain; charset=utf-8" file="#filePath#" /> </cfif>
... which results in images and so forth being rendered to the screen in binary unless the format parameter is sent in the URL and it doesn't have the value "text". Since the format parameter is never sent at all (that I can see) this results in the error. Oddly this behaviour isn't present on the live demo, which leads me to wonder if the demo was patched already?
When the logic is reversed to this it works as expected (the file is downloaded unless the "format=text" parameter is sent in the URL.
<cfif structkeyexists(URL, "format") and URL.format eq "text"> <cfcontent type="text/plain; charset=utf-8" file="#filePath#" /> <cfelse> <cfheader name="Content-Disposition" value="attachment; filename=#ReReplace(fileName,'\s', '_','all')#"> <cfcontent type="application/octet-stream" file="#filePath#" /> </cfif>
full CFC attached.
Re: CKFinder 2.0 - DownloladFile.cfc - bug?
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+