Hi, I need to upload an image from my computer and convert(cast) it to varbinary and store it in my SQL table's IMG(varbinary) column. I tried somethings but i always get new errors. First i tried to choose img on html page and then UPDATE NULL column on my already created data's. html page <cfform action="#request.page#?event=do.test.abz_upload" name="upload" method="post"> <input type="file" name="fpic" accept="image/*"> <cfinput type = "submit" name = "Submit6" value = "Yükle"> </cfform> action page <cfquery name="upload" datasource="test"> DECLARE @img varbinary; SET @img = CAST(#fpic# AS varbinary); <!--- also tried CONVERT ---> UPDATE dbo.FILMS SET IMG = @img WHERE FILM_ID = 3 ; </cfquery> <cflocation url="#request.page#?event=vi.test.abz_test" addtoken="no"> <cfquery name="upload" datasource="test"> UPDATE dbo.FILMS SET IMG = CAST(#fpic# AS varbinary) WHERE FILM_ID = 3 ; </cfquery> <cflocation url="#request.page#?event=vi.test.abz_test" addtoken="no"> error Error Executing Database Query. [Macromedia][SQLServer JDBC Driver][SQLServer]Invalid column name 'Pulp'. my image name is 'Pulp-Finction1.png' if i change it to 3.png it gives this error: Error Executing Database Query. [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near 'png'. Then i tried insert new data to my table html page <cfform action="#request.page#?event=do.test.abz_upload" name="upload" method="post"> <input type="text" name="fname"> <input type="file" name="fpic" accept="image/*"> <cfinput type = "submit" name = "Submit6" value = "Yükle"> </cfform> action page INSERT INTO dbo.FILMS(FILM_NAME, IMG) VALUES(#form.fname#,#form.fpic#) Error, 3.png Error Executing Database Query. [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near 'png'. last i tried this kind of a thing but gives me BytesArray cannot be cast to String last game <cffile action = "readBinary" file = "C:\Users\BURAK\Desktop\Pulp-Fiction1.png" variable = "fpic"> <!--- also tried //myserver..../3.png ---> <cfquery name="upload" datasource="test"> UPDATE dbo.FILMS SET IMG = #fpic# WHERE FILM_ID = 3 ; <!--- also tried CAST and CONVERT ---> </cfquery> Anyone have an idea how can i do it?
... View more