Skip to main content
Known Participant
March 19, 2008
Question

CFFILE Read action

  • March 19, 2008
  • 3 replies
  • 348 views
Can anyone tell me how to read a file (.txt file) using CFFILE Read action but the file is located in a different directory?

In my ReadFile.cfm I have:

<CFPARAM NAME="ATTRIBUTES.L_Filenames" DEFAULT="#request.ClientName#/MyFolder/CompanyName/PESFeed.txt" >
<!--- #request.ClientName# is wwwroot --->

<CFFILE ACTION = "READ" FILE = "#Filename#" VARIABLE = "fileContents">

the error I got says:
An error occurred when performing a file operation READ on file C:\CFusionMX\runtime\servers\default\SERVER-INF\temp\wwwroot-tmp\wwwroot/MyFolder/CompanyName/PESFeed.txt.
The cause of this exception was: java.io.FileNotFoundException: C:\CFusionMX\runtime\servers\default\SERVER-INF\temp\wwwroot-tmp\wwwroot\SAN\WellsFargoWFI\PESFeed.txt (The system cannot find the path specified).

How can I point CFFILE to read PesFeed.txt that is located in a different directory than where ReadFile.cfm is?








This topic has been closed for replies.

3 replies

Inspiring
March 19, 2008
Dan Bracuk wrote:
> But with backslashes, not forward slashes.

Yeah, ok that is true. That is what I get for working in both a Unix
and Windows environment. I can never keep my slashes straight "|" :-)
Inspiring
March 19, 2008
But with backslashes, not forward slashes.

Here is something from the app I am taking a short break from:

FTP_in = "d:\dw\ftproot\Script";
TheFile = "cost_centre_info.dat";

<cffile action="read" file="#FTP_in#\#TheFile#" variable="FileContent">
Inspiring
March 19, 2008
alecken wrote:
> How can I point CFFILE to read PesFeed.txt that is located in a different
> directory than where ReadFile.cfm is?

By using the fully qualified path to the desired path, something like
"c://path/to/my/file.txt"