Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Uploading images to SQL as BLOB

Status
Not open for further replies.

saraca

Programmer
Nov 8, 2004
4
0
0
US
I have a page that lets the user upload an image to change the logo of the website. It works fine on ColdFusion MX7 but on earlier versions I get the following error;


Attribute validation error for tag CFQUERYPARAM.
The value of the attribute VALUE is invalid. The value cannot be converted to a string because it is not a simple value.Simple values are booleans, numbers, strings, and date-time values.

The Error Occurred in E:\Websites\Caracas\adm\upload_action.cfm: line 17

15 : <cfquery name="insImg" datasource="#Application.dsname#">
16 : UPDATE siteconfiguration
17 : SET logo = <cfqueryparam value="#MyBinary#" cfsqltype="cf_sql_blob">
18 : WHERE (coname = '#Application.coname#')
19 :


Here is the code that I'm using:
<cffile action="readbinary" file="#form.upload#" variable="logo" accept="image/*">

<cfquery name="insImg" datasource="#Application.dsname#">
UPDATE siteconfiguration
SET logo = <cfqueryparam value="#logo#" cfsqltype="cf_sql_blob">
WHERE (coname = '#Application.coname#')
</cfquery>


 
do a cfdupm on the variable 'logo' or a cfoutput to see it on the screen so you know what you are playing with. it should be a string...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top