I'm following a tutorial by Ben Nadel and I am receiving the following error in browser Network/XHR.
Complex object types cannot be converted to simple values
I think the problem is in the CFLoop tag but I'm not sure exactly what I should modify to resolve the error.
Get the content as a byte array (by converting it to binary,
we can echo back the appropriate length as well as use it in
the binary response stream.
<cfset binResponse = ToBinary(ToBase64( objRequest.FileContent )) />
<!--- Echo back the response code. --->
<cfheader statuscode="#Val( objRequest.StatusCode )#" statustext="#ListRest( objRequest.StatusCode, ' ' )#" />
<!--- Echo back response legnth. --->
<cfheader name="content-length" value="#ArrayLen( binResponse )#" />
<!--- Echo back all response heaers. --->
<cfloop item="strKey" collection="#objRequest.ResponseHeader#">
<!--- Check to see if this header is a simple value. --->
<cfif IsSimpleValue( objRequest.ResponseHeader[ strKey ] )>
<!--- Echo back header value. --->
<cfheader name="#strKey#" value="#objRequest.ResponseHeader[ strKey ]#" />
Echo back content with the appropriate mime type. By using
the Variable attribute, we will make sure that the content
stream is reset and ONLY the given response will be returned.
<cfcontent type="#objRequest.MimeType#" variable="#binResponse#" />