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

Reading a file

Participant ,
Sep 07, 2008 Sep 07, 2008

Copy link to clipboard

Copied

I have a text file on a W2K file server on my network that I need to retrieve by a ColdFusion Server on the same network how might I accomplish this?

I have tried this.
<cffile action="read" file="Z:\my_data.txt" variable="myData" />
An error occurred when performing a file operation read on file Z:\my_data.txt.
The cause of this exception was: java.io.FileNotFoundException: Z:\my_data.txt (The system cannot find the path specified).
I have tried this.
<cfscript>
oFile = FileOpen("Z:\my_data.txt", "read");
</cfscript>
I have Tried the server name and IP like this.
<cfscript>
oFile = FileOpen("D:\192.168.1.10\Public\Installs\my_data.txt", "read");
</cfscript>
TOPICS
Advanced techniques

Views

422

Translate

Translate

Report

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

correct answers 1 Correct answer

Participant , Sep 07, 2008 Sep 07, 2008
When I map a drive inside my network it is always \\designsbg\installs
to reach that folder.

Votes

Translate

Translate
Explorer ,
Sep 07, 2008 Sep 07, 2008

Copy link to clipboard

Copied

My guess is that you do not have the 'Z' drive mapped on the CF server. On your second example, the UNC name isn't formatted quite right. Instead of the 'D:\' in front of the IP address, try '\\' instead. So assuming you have a share on that server named 'Public', try using:
"\\192.168.1.10\Public\Installs\my_data.txt"

Votes

Translate

Translate

Report

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
Participant ,
Sep 07, 2008 Sep 07, 2008

Copy link to clipboard

Copied

Thanks, I tried that but it says that the file cannot be found. I also tried
oFile = FileOpen("\\designsbg\Public\Installs\my_data.txt", "read");
AND
oFile = FileOpen("\\designsbg\Installs\my_data.txt", "read");
And with the IP Address
The folder that is shared is Installs.

Votes

Translate

Translate

Report

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
Participant ,
Sep 07, 2008 Sep 07, 2008

Copy link to clipboard

Copied

When I map a drive inside my network it is always \\designsbg\installs
to reach that folder.

Votes

Translate

Translate

Report

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
Participant ,
Sep 07, 2008 Sep 07, 2008

Copy link to clipboard

Copied

LATEST
I got it to work thanks.

Votes

Translate

Translate

Report

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
Documentation