I hope this doesn't get too long, but here are three files that will do what you want. Make sure to enable BLOB support in your CF/SQL DSN.
GetFile.cfm ----------- <cfsetting enablecfoutputonly="Yes"> <cfquery name="variables.q" datasource="DSN"> SELECT fileName ,contentType ,contentSubType ,binaryContent FROM TestUpload WHERE id = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#URL.id#"> </cfquery> <cfheader name="content-disposition" value="attachment; filename=#variables.q.fileName#"> <cfcontent type="#variables.q.contentType#/#variables.q.contentSubType#"> <cfoutput>#ToString(variables.q.binaryContent)#</cfoutput> UploadForm.cfm -------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>File Upload</title> </head> <body> <form action="UploadAction.cfm" name="uploadForm" method="post" enctype="multipart/form-data"> <input type="file" name="uploadFile"> <input type="submit" name="btnUpload" value="Upload File"> </form> <cftimer label="Query to Retrieve Uploaded Files" style="inline"> <cfquery name="variables.list" datasource="DSN"> SELECT id ,fileName ,contentType ,contentSubType ,fileSize FROM TestUpload ORDER BY id </cfquery> </cftimer> <cftimer label="Generate Table to Display Database Records" style="inline"> <table border="1"> <cfoutput query="variables.list"> <tr> <td>#variables.list.id#</td> <td><a href="GetFile.cfm?id=#variables.list.id#">#variables.list.fileName#</a>< /td> <td>#variables.list.contentType#</td> <td>#variables.list.contentSubType#</td> <td align="right">#NumberFormat(variables.list.fileSize)#</td> </tr> </cfoutput> </table> </cftimer> </body> </html> UploadAction.cfm ---------------- <cftimer label="CFFILE Upload" style="inline"> <cffile action="upload" fileField="form.uploadFile" destination="#ExpandPath(".")#" nameConflict="MakeUnique"> </cftimer> <cftimer label="cffile dump" style="inline"> <cfdump var="#cffile#"> </cftimer> <cftimer label="cffile readbinary" style="inline"> <cffile action="readBinary" file="#cffile.serverDirectory#\#cffile.serverFile#" variable="variables.myFile"> </cftimer> <p>Length of variable: <cfoutput>#Len(variables.myFile)#</cfoutput></p> <p>IsBinary? <cfoutput>#IsBinary(variables.myFile)#</cfoutput></p> <cftimer label="Insert File into Database" style="inline"> <cfquery name="insertFile" datasource="DSN"> INSERT INTO TestUpload ( fileName ,contentType ,contentSubType ,binaryContent ,fileSize ) VALUES ( <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#cffile.serverFile#"> ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#cffile.contentType#"> ,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#cffile.contentSubType#"> ,<cfqueryparam cfsqltype="CF_SQL_BLOB" value="#variables.myFile#"> ,<cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#cffile.fileSize#"> ) </cfquery> </cftimer> -----Original Message----- From: Blaha, James (InfoTechServ) [mailto:[EMAIL PROTECTED] Sent: Friday, October 21, 2005 1:03 PM To: CF-Talk Subject: Saving a document in a SQL Server table. CF Pro's, Question can anyone send me information or a good URL for creating simple functionality to have a user be able to upload a file i.e. a word document and have it save in a SQL Server table. Then show me how I could do the reverse and serve the file back to a user? I'm running CFMX7 and SQL Server 2000 Regards, Jim Blaha ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:221858 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54