Insert images into MySQL (or any DB really)
<cfoutput>
<!--- The form to upload the image --->
<form action="#cgi.SCRIPT_NAME#" method="post" enctype="multipart/form-data">
<input type="File" name="imgFile"/>
<input type="Submit" value="submit"/>
</form>
<cfif isDefined("form.imgFile")>
<!--- UPload the image to the server --->
<cffile
action="UPLOAD"
filefield="imgFile"
destination="C:web"
nameconflict="OVERWRITE"/>
<!--- Read the file as binary to be inserted into the DB --->
<cffile
action="READBINARY"
file="#cffile.SERVERDIRECTORY##cffile.SERVERFILE#"
variable="binaryImgFile"/>
<!--- Conver the binary to toBase64, this converts the binary to printable form --->
<cfquery datasource="test" name="upldBinImg">
INSERT INTO tablename
SET q = '#toBase64(binaryImgFile)#'
</cfquery>
</cfif>
</cfoutput>
<!--- The form to upload the image --->
<form action="#cgi.SCRIPT_NAME#" method="post" enctype="multipart/form-data">
<input type="File" name="imgFile"/>
<input type="Submit" value="submit"/>
</form>
<cfif isDefined("form.imgFile")>
<!--- UPload the image to the server --->
<cffile
action="UPLOAD"
filefield="imgFile"
destination="C:web"
nameconflict="OVERWRITE"/>
<!--- Read the file as binary to be inserted into the DB --->
<cffile
action="READBINARY"
file="#cffile.SERVERDIRECTORY##cffile.SERVERFILE#"
variable="binaryImgFile"/>
<!--- Conver the binary to toBase64, this converts the binary to printable form --->
<cfquery datasource="test" name="upldBinImg">
INSERT INTO tablename
SET q = '#toBase64(binaryImgFile)#'
</cfquery>
</cfif>
</cfoutput>