I'm trying to configure redactor for ColdFusion with a simple image upload script. The image doesn't actually upload to the server and I don't know how to get the variables back to ColdFusion for use by redactor. I can't seem to get their sample code converted properly to ColdFusion .
My call to the function is here:
this.article_content.redactor({ focus: true,
buttons: [ 'html', '|', 'formatting', '|', 'bold', 'italic', 'underline', '|', 'unorderedlist', 'orderedlist', '|',
'image', 'video', 'file', 'link', '|',
'fontcolor', '|', 'alignment', '|', 'horizontalrule', 'alignleft', 'aligncenter', 'alignright', 'justify'],
imageUpload: 'lib/modules/imageUpload.cfm'
});
imageUpload.cfm
<cfparam name="form.file" default="">
<cffile action="upload" destination="#dir#" accept="image/*" nameconflict="overwrite" filefield="file"/>
<cfset result = structnew()>
<cfset result["name"] = cffile.serverFile>
<cfset result["url"] = cffile.serverFile>
<cfset result["filelink"] = cffile.serverFile>
<cfset result["type"] = cffile.ContentType &"/"& cffile.ContentSubType>
<cfset result["size"] = cffile.FileSize>
<cfreturn serializejson(result)>
Should this be a cfm page or a cfc page? I basically just need to convert the serverFile variable to a json object that looks like this:
{ "url": "/images/img.jpg", "id": "123" }
cffile action="upload"? What does yourimageUpload.cfmlook like? - Alex