How to store a Word document as a BLOB in mySQL with Coldfusion -
a client wants word documents saved mysql database despite me arguing against. documents should not particularly large, no more 1 mb each. have enabled blob in cf administrator , set blob buffer 1,000,000
here's sql
<cfset newmessageid=1569> <cfset filename="c:\temp\0.doc"> <cffile action = "readbinary" file = "#filename#" variable = "filedata"> <cfquery name="addfile" datasource='#application.dsn#'> insert files (fileid, filedata) values (#newmessageid#, <cfqueryparam value="#filedata#" cfsqltype="cf_sql_blob">) </cfquery>
i "data truncation: data long column 'filedata' @ row 1" error. filedata field in files table set blob. doing wrong?
cf 9.01, mysql 5.4
what doing wrong
what kind of blob? there different types including long , medium blob. blob (approximately) 2^16 = 65,536 bytes, medium blob 2^24 = 16,777,216 bytes. if think might exceed medium blob, go longblob ie 2^32.
Comments
Post a Comment