Ask a Question related to Coldfusion - Getting Started, Design and Development.
-
cjdunkerley #1
CFHTTP get file problem
Hi,
I have code to read a text file on my server and process it into a database,
this works fine. The text file comes from a remote server that I I currently
have to copy and paste the text file from.
I have been trying to use cfhttp to get the file but it gets the html version
of the file and not what is being displayed, i.e the file contains <br> at the
end of the lines. This is causing errors when I use the 'name' variable and
also if I try to read the file after saving http.filecontent.
Everything works fine if I copy and paste the data from the page!
I know there must be a way to automate this but I can not find it... any help
is appreciated.
Regards,
Chris.
cjdunkerley Guest
-
cfhttp query text file
I use cfhttp to create a query from an ascii text file. The text file is comma delimited, with quotes around text. This works fine in CF5 and... -
Problem with looping over cfhttp
Hi, I am trying to get some image files from a remote server and save them to my server. I have all the paths in a query but when I loop over... -
CFHTTP Get Problem
I have set up a Cfhttp screen to load data into my application. I am using the cfhttp tag to create a query variable that returns the data. I am... -
Cfhttp problem
Im trying to loop through an array elements (in this case URLs) using cfhttp, there are several elements in the array but I can only cfhttp the... -
text file to query using cfhttp
Did you ever find out what causes this issue? It's happening to me now... String index out of range: -1 Same situation, only I'm using a single... -
Stressed_Simon #2
Re: CFHTTP get file problem
After you read the file use Replace() to change the <br> tags to Carriage return line feeds.
ie <cfset myText = Replace(CFHTTP.FileContent, Chr(13) & Chr(10), "ALL")>
Stressed_Simon Guest
-
cjdunkerley #3
Re: CFHTTP get file problem
Thanks Simon,
It now works! Code for reference:
<cfhttp method="post" url="http://xxxxxxx/FILES/csv.cfm" timeout="1000">
<cfhttpparam type="formfield" name="UserLogin" value="xxxxx">
<cfhttpparam type="formfield" name="UserPassword" value="xxxxx">
</cfhttp>
<cfset p_data = Replacenocase(CFHTTP.FileContent, "<br>", Chr(13) & Chr(10),
"ALL")>
<cffile action="write" file="xxxxx\msepdata_test1.txt"
nameconflict="overwrite" output="#p_data#">
<cfx_text2query file="xxxx/msepdata_test1.txt"
firstRowIsHeader="true" rQuery="rsPropData"> <!--- this is a custom tag
--->
<cfdump var="#rsPropData#">
cjdunkerley Guest



Reply With Quote

