Upload File to Database in ColdFusion

Posted by George Johnston on Stack Overflow See other posts from Stack Overflow or by George Johnston
Published on 2010-03-07T23:51:01Z Indexed on 2010/03/07 23:53 UTC
Read the original article Hit count: 236

Filed under:
|

I simply would like to upload a file to my database using ColdFusion. I understand how to upload an image to a directory, but I would like to place it directly in the database.

I have set a database field to varbinary(MAX) to accept the image and have the stored procedure to insert it. Currently my code for uploading the image to my file system is:

<cfif isdefined("form.FileUploadImage")> 
            <cffile action="upload" filefield="FileUploadImage" destination="#uploadfolder#" nameconflict="overwrite" accept="image/*" > 
</cfif>

I've obviously left some of the supporting code out, but really all I need to do is get a binary representation of the file stored in memory, instead of the file system.

Any experts out there that can help?

Thanks, George

© Stack Overflow or respective owner

Related posts about coldfusion

Related posts about image-uploading