Skip to main content
May 27, 2009
Answered

CF equivalent of PHPs $GLOBALS["HTTP_RAW_POST_DATA"]

  • May 27, 2009
  • 1 reply
  • 1226 views

I am working on a Flash project that will export a jpg image to the user. I found a PHP script that does what I need, but I am having trouble converting it to ColdFusion. The part that I am stuck on is finding a ColdFusion equivalent of $GLOBALS["HTTP_RAW_POST_DATA"]. I have included the original PHP script I used as well as the ColdFusion part as I have it to this point. Any help would be greatly appreciated.

Original PHP Script...

---------------------------------------------------------

if (isset($GLOBALS["HTTP_RAW_POST_DATA"]))
{
// get bytearray
$jpg = $GLOBALS["HTTP_RAW_POST_DATA"];


// add headers for download dialog-box
header('Content-Type: image/jpeg');
header("Content-Disposition: attachment; filename=".$_GET['name']);
echo $jpg;
}

--------------------------------------------------------------------------------

What I tried in CF...

-------------------------------------------------------------

<cfset x = GetHttpRequestData()>

<cfcontent type="image/jpeg">
<cfheader name="Content-Disposition" value="attachment; filename=#url.name#">
<cfoutput>#ToString(x.content)#</cfoutput>

---------------------------------------------------------------

This topic has been closed for replies.
Correct answer mack_

Use the cfcontent tag with the variable attribute instead of ToString(...)


]]>

Mack

1 reply

mack_Correct answer
Participating Frequently
May 27, 2009

Use the cfcontent tag with the variable attribute instead of ToString(...)


]]>

Mack

May 27, 2009

Thanks Mack! That fixed it.