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

FileReadLine() bug - SOLVED

New Here ,
Apr 24, 2008 Apr 24, 2008
I have a file that has HTML along with coldfusion tags. I have to read in data files then somehow get this HTML file to the users PC as a word doc. I thought I could use the FileReadLine() to read a line then use the CFFILE action append to write a file to the server. I found that when <HTML> was read in nothing was written to the file. If I change the text to HTML> then HTML> is written out. I put a cfoutput tag in my function to output what was passed, when <HTML> was read the function received nothing or spaces, when HTML> was read the function received HTML>.
282
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
LEGEND ,
Apr 24, 2008 Apr 24, 2008
How about you post your code?

--
Adam
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
New Here ,
Apr 25, 2008 Apr 25, 2008
Here is my code
<cfscript >
myfile = FileOpen("C:\ColdFusion8\wwwroot\OIG Generator\oig.txt","read");
while (! FileIsEOF(myfile))
{
x = FileReadLine(myfile);
writefile(x);
}
</cfscript>
<cffunction name="writefile">
<cfargument name="lineToWrite">
<cfoutput>#lineToWrite#</cfoutput>
<cfabort>
<cffile action="append" file = "#variables.OIG_file##EnvCount#.txt"
output = "#lineToWrite#">
</cffunction>
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
LEGEND ,
Apr 25, 2008 Apr 25, 2008
LATEST
> <cfoutput>#lineToWrite#</cfoutput>

So you're outputting some text data which has HTML in it, in a browser?
Browser don't *display* HTML tags do they? They render them.

I imagine if you view-source, the text data is actually there.

Or your could use htmlEditFormat() to escape the HTML, in which case it
would display rather than render.

Obviously, also your <cfabort> is going to stop processing on the first
line processed. I realise this is in the for debugging, but what if the
first line of your dta file actually *is* empty?

--
Adam
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