27 November 2008

Downloading files from the database with CF

If you use your database as a file store and coldfusion as your webserver, you'll doubtless one day want to download those files from a cfm page.

here are two useful snippets that had me stuck for a while:

To download the image:

< cfheader name="Content-Disposition" value="attachment; filename=" >
< cfcontent type="#fileType#/#fileSubtype#" variable="#fileData#" >

this is important, you need to enable blob downloads in cfadmin.

  1. Open up your datasource in cfadmin,

  2. click advanced,

  3. check the checkbox marked: "Enable binary large object retrieval (BLOB)."

04 November 2008

coldFusion and SQL Express

Hey Boys and girls. I recently tried to install ColdFusion 8 and SQL express 2005.

Quite easy but a couple of points to remember for next time:

1) TCP/IP needs to be enabled in sql connection manager (weird that its disabled)
2) TCP/IP needs to be given a default port (cf uses 1433)

After you've done this restart sql (or the whole computer) and you should be ready to go.