Search Results

There are 2 item(s) tagged with the keyword "File".

  • Displaying: 1 - 2 of 2
1. Problem to upload large size files using CFFTP

Recently I am trying to upload a file and I get error message “An error occurred during the FTP putfile operation”. The CFFTP tag has one attribute ‘timeout’. It specifies maximum numbers of seconds (time) taken to perform CFFTP action (operation). Here, I am not specified the ‘timeout’ attribute of CFFTP tag. So it take default value ‘30’ seconds. And that cause the issue to upload large size files (size in MB) that takes more than 30 seconds to upload.

Tags: ColdFusion, File
By Mahavir Dhruv
2. Read File line by line in ColdFusion by using Java Classes

HI,
I was having situation where I wanted to read a file and process each line.
I think cffile tag is not much to do it, so I use java classes.
Basically we need two kinds of classes.
1. InputSream
2. Buffer reader

Buffer reader is capable to read any input stream line by line.

Final code will look like:

<cfscript>
	FileName = expandPath('/temp.txt');
	objFileReader = createObject("java","java.io.FileReader");
	InputStreamReader = objFileReader.init(FileName);
	objBuffer = createObject("java","java.io.BufferedReader" );
	LineIO = objBuffer.init(InputStreamReader);
	</cfscript>
	
	<cfset eof = 0>
	<cfset cnt = 1>
	<cfloop condition="not eof">
	<cfset currline = LineIO.readline()>
	<cfif isdefined("currline") eq "no">
	<cfset eof = 1>
	<cfbreak>
	</cfif>
	<cfoutput>line #cnt#: #currline#<br/></cfoutput>
	<cfset cnt = cnt + 1>
	<cfflush>
	</cfloop>

Tags: File, ColdFusion
By Vikas
  • Displaying: 1 - 2 of 2

Didn't find what you were looking for? Refine your search and try again.