
Copy link to clipboard
Copied
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>
---------------------------------------------------------------
1 Correct answer
Use the cfcontent tag with the variable attribute instead of ToString(...)
<cfcontent type="image/jpeg" variable="#x.content#">
Mack
Copy link to clipboard
Copied
Use the cfcontent tag with the variable attribute instead of ToString(...)
<cfcontent type="image/jpeg" variable="#x.content#">
Mack

Copy link to clipboard
Copied
Thanks Mack! That fixed it.

