You mean store the file content in the db, not just the file path (ie "c:\path\myImage.gif")? While you can do it, it can drastically bloat your database. But if you really want to do it, here is an example. It's for Oracle but the overall process is the same for any db.
http://awads.net/wp/2006/01/25/savingdownloading-files-tofrom-oracle-using-coldfusion/
Just upload the file as usual ie using . But instead of storing the file path, you read the *contents* of the file into a variable. Then insert the variable's binary data into the database instead of the path. When you're done, you can delete the uploaded file.
<cffile action="readBinary"
file="#cffile.serverDirectory#/#cffile.serverFile#"
variable="fileContents">
<cfquery name="addFile" ....>
INSERT INTO Table ( FileName )
VALUES (
<cfqueryparam value="#fileContents#" cfsqltype="cf_sql_blob">
)
</cfquery>
<!--- once done, delete the physic. file --->
<cffile action="delete"
file="#cffile.serverDirectory#/#cffile.serverFile#" >
Retrieving the file from the db is the same as any SELECT. Just retrieve the record, and use CFCONTENT, with the proper mime type to display it in the browser. If you need any help with that part, just let me know.
One thing to watch out for is your CF datasource settings. If you have files that bigger than 64K, CF will only return the 1st 64K bytes unless you enabled the "BLOB" setting in your datasource. http://awads.net/wp/2006/02/21/lobs-gotcha-in-coldfusion/