Thanks for the suggestions. That doesn't work for a couple reasons.
It looks like toByteArray is a method from the underyling Java class,
but since I'm using a regular ColdFusion variable, I don't have access
to it. And actually, since my variable is already a Byte Array, I
wouldn't need to convert it anyway.
It seems to me the problem is really a Wheels bug in the $create
function of crud.cfm. It apparently forces an implicit cast to
varchar by trying to determine if the field is null. See the very
last portion of this statement:
loc.param = {value=this[loc.key],
type=variables.wheels.class.properties[loc.key].type,
scale=variables.wheels.class.properties[loc.key].scale, list=false,
null=this[loc.key] IS ""};
If I replace
this[loc.key] IS ""
with
On Jan 26, 10:57 am, Chris Peters <
chrisdpet...@gmail.com> wrote:
> Try changing the second-to-last line and see if it works (bolded below)...
>
> <cfset contentDetail = model("contentInline").new(params.contentDetail)>
> <cffile action="UPLOAD" filefield="fileInline"
> destination="#getDirectoryFromPath(getCurrentTemplatePath())#"
> nameconflict="OVERWRITE">
> <cfset contentDetail.attachmentFilename = cffile.ServerFile>
> <cfset contentDetail.attachmentMime =
> "#cffile.ContentType#/#cffile.ContentSubType#">
> <cfset contentDetail.attachmentFilesize = cffile.FileSize>
> <cfset contentDetail.attachmentExtension = cffile.ClientFileExt>
> <cffile action="readbinary" file="#form.fileInline#"
> variable="binaryAttachy">
> *<cfset contentDetail.attachment = binaryAttachy.toByteArray()>*
> <cfset contentDetail.save()>
>
> I got that tip from here. You may want to review their approach, although
> their situation was a little different than yours.
http://www.overset.com/2007/03/02/store-binary-data-in-mysql-with-col...
>
> Let us know what you come up with!
>