I have a Backbone front-end that is sending restful calls with an uploaded file to a Coldfusion backend.
I need to know how to 'get at' the file once it has reached my CFC. Unfortunately i have some doubt as to whether the file is being sent at all, my POST goes off fine and returns a basic string from the CFC so i know that is working.
The POST payload looks like this
------WebKitFormBoundarymjCH1xJJ2D10ncj8
Content-Disposition: form-data; name="qqfile"; filename="Jellyfish.jpg"
Content-Type: image/jpeg
------WebKitFormBoundarymjCH1xJJ2D10ncj8--
I am using jquery FineUploader to send the request.
I am currently using this to try and pick up the file on the CFC end.
<cfcomponent displayname="import"
rest="true"
restPath="/import">
<cffunction name="import"
access="remote"
httpMethod="POST"
produces="application/json"
returntype="string">
<cfset local.testResponse= "Response">
<cfset local.testDebug= "Test Debug">
<cfif IsDefined("Form.UploadFile") AND Form.UploadFile NEQ "">
<cfsavecontent variable="local.debugInfo">
<cfdump var="#local.testDebug#">
</cfsavecontent>
<cffile action="write" file="c:\Coldfusion10\cfusion\wwwroot\backend\debugInfo.html" output="#local.debugInfo#">
</cfif>
<!--- GET THE FILE SENT WITH THE AJAX CALL AND DO SOMETHING --->
<!--- Here we should return some JSON that has a success value? --->
<cfreturn local.testResponse>
</cffunction>
</cfcomponent>
I think there is probably some concept i am missing here so im unsure of how to really word this question. Apologies...