Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

CF equivalent of PHPs $GLOBALS["HTTP_RAW_POST_DATA"]

Guest
May 27, 2009 May 27, 2009

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>

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

TOPICS
Advanced techniques
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , May 27, 2009 May 27, 2009

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

<cfcontent type="image/jpeg" variable="#x.content#">

Mack

Translate
Enthusiast ,
May 27, 2009 May 27, 2009

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

<cfcontent type="image/jpeg" variable="#x.content#">

Mack

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 27, 2009 May 27, 2009
LATEST

Thanks Mack! That fixed it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources