Skip to: Site menu | Main content

Email Facebook LinkedIn Twitter Google

Blog...

Change Coldfusion Temporary Files Location Used by GetTempDirectory()

I wanted to change the default location Coldfusion uses for temporary storage when using:

<cffile action="upload">

This meant changing the default location returned by GetTempDirectory()

EDIT %CFusion%\runtime\servers\coldfusion\SERVER-INF\jrun.xml Comment this line:

<attribute name="temporaryDirectory">{jrun.server.rootdir}/SERVER-INF/temp</attribute>

Add this key:

<attribute name="temporaryDirectory">{YourFullTempFolderPath}</attribute>

So that you have this:

<!-- <attribute name="temporaryDirectory">{jrun.server.rootdir}/SERVER-INF/temp</attribute> -->
<attribute name="temporaryDirectory">C:\ExampleCustomTempPath</attribute>

RESTART the Coldfusion Application service

NOTE: Coldfusion will create a subfolder in the temporary directory named wwwroot-tmp

Android Emulator Virtual Hosts with IIS

I do most of my development locally (using my local IIS webserver). My local webserver makes use of host headers to host multiple development sites on a single IP. After reading several articles and blog entries I was unable to find a good solution to allow using host headers with Android. The emulator can access the host machine out of the box on 10.0.2.2, but that will only show you the default IIS site.

Tom Deryckere's article (http://www.mobiledrupal.com/content/using-virtual-hosts-android-emulator) explains how to get host headers working on the emulator, but I didn't want to run terminal commands every time I launched the emulator or keep updating my host file across mulitple emulator images (I'm really lazy.)

The solution was pretty simple and I'm embarrassed that I didn't think of it before. I simply added another binding entry to a new port:

In IIS Manager:

  1. Select the site you want to access
  2. Click 'Bindings' in the right side Actions pane
  3. Click 'Add...' on the Site Binding dialog that is displayed
  4. Give the site a any valid port number that is not currently in use (example 9191)

Now in the Android emulator you can access your site using http://10.0.2.2:9191

FCKEditor in Coldfusion

I began using FCKEditor long before it was included with Coldfusion. I've continued to use my own implemenation even after the release of Coldfusion 8.

There was a vulnerability found in the included FCKEditor: http://www.adobe.com/support/security/bulletins/apsb09-09.html

I applied the patch to my server and it also broke my own FCKEditor instance. I received "403 Access Denied" errors when using the FCKEditor file browser. After much time and effort the solution is pretty simple:

Add this to your JVM args in jvm.config: -Dcoldfusion.fckupload=true

***CAREFUL about copying and pasting the text above. Hidden carriage returns will cause CF to fail on startup.***

Even if you are not using the Coldfusion FCKEditor you still need to enable FCKEditor uploads. The updated JAR must have a built-in request filter for "filemanager".

http vs. https links.

Thanks to Tim Jackson for bringing this one to my attention. Since I've worked in Coldfusion I've always used code similar to this:


<cfset variables.protocol = iif(CGI.SERVER_PORT EQ 443, de("https"), de("http"))>

So that I could avoid the "This page contains unsecure items." message when embedding Flash, Javascript, images, etc.


<img src="#variables.protocol#://www.foo.com/linkedimage.jpg"/>

Tim advised me that he had found a new way to avoid this without using server-side code:


<img src="//www.foo.com/linkedimages.jpg"/>

Apparently the browser retains the current protocol. I've tested this in IE7 and Firefox using images, Flash, anchors, and javascript.