Skip to main content
January 30, 2011
Question

Chttp receiving page breaking the variable

  • January 30, 2011
  • 1 reply
  • 577 views

I have a program doing a cfhttp get to a url with two variables: a file name and an id. The id is being sent correctly. 1234556. However, once it gets to the receiving page and I do an output of that value to check it, it shows up as 1 2 3 4 5 6.  While I can do a replace on that end for the spaces, the file name generation that includes that id then breaks as well. I'm using Colfusion 5.0..

An example:

<cfset appid = "1234565">

<cfset appfile = "abc_" + #appid#>

<cfhttp url="index.cfm?appfile=#appfile#&appid=#appid#" timeout=5>

A write to file from the index.cfm page to show both variables shows as this:

abc_1 2 3 4 5 6 1 2 3 4 5 6

It also shows a special character.. not sure if it's a line break or not.. it's a little square next to the appid.

Any ideas would be appreciated.

Thanks!

This topic has been closed for replies.

1 reply

Inspiring
January 31, 2011

I'm surprised it actually runs given that you are not using the correct concatonation operator.

February 1, 2011

Ahhh.. so it seems. That was a mistype on my part... I had the code at work, and am still getting used to Coldfusion after not working with it for a while.

Here is the actual code:


<cffile action="read" file="/code/iplanet/docs/info.txt" variable="filecontent">
               <cfloop index="index" list="#filecontent#" delimiters="|">
               <cfset appfile = "info" & "_"
          & index & "_"
          & numberformat(year(now()),"0009")
          & numberformat(month(now()),"09")
          & numberformat(day(now()),"09")
          & "_"
          & numberformat(hour(now()),"09")
          & numberformat(minute(now()), "09")
          & numberformat(second(now()) ,"09")
          & "_"
          & randrange(1000,9999)>


          <cfhttp url = "http://fullurl/process.cfm?appfile=#appfile#&appid=#index#" method="get" timeout=5>

Process.cfm page:

I currently do this to fix the spaces in the appid
<cfset client.appid = Replace(url.appid," ","","all")>

The rest is the same.. extra spaces, special character after the last number of the appid

Inspiring
February 1, 2011

What happens if you use hard coded values instead of variables in the url string?