Skip to main content
BurtleEd
Known Participant
February 26, 2010
Answered

ExpandPath to a mapped drive question

  • February 26, 2010
  • 2 replies
  • 829 views

We have an intranet site with a page that is controlled by an XML file. Right now the XML file is located on the web root. I wanted to see if I caould have the XML file on a mapped drive. It errors out with the path below.

<cfset CoolXmlFile = ExpandPath("Y:/COOP/Metwatch/modify/bk1.xml") />

<cffile action="read" file="#CoolXmlFile#" variable="input_xml" />

Here is the error. for some reason it puts a slash in....?

An error occurred when performing a file operation read on file C:\wwwroot\Layout\FrontPage\bk1\Y:\COOP\Metwatch\modify\bk1.xml.

The cause of this exception was: java.io.FileNotFoundException: C:\wwwroot\Layout\FrontPage\bk1\Y:\COOP\Metwatch\modify\bk1.xml (The filename, directory name, or volume label syntax is incorrect).

    This topic has been closed for replies.
    Correct answer

    Make sure the file permissions are right...  You WILL need to switch CF to using a Domain Login in the service properties to get the UNC crap to work.

    D.

    2 replies

    Correct answer
    February 26, 2010

    Make sure the file permissions are right...  You WILL need to switch CF to using a Domain Login in the service properties to get the UNC crap to work.

    D.

    Inspiring
    February 26, 2010

    Does the CF server have permissions to that file location?

    How is the drive mapping created?  If it's just via "map a network" in Windows explorer, that's specific to your Windows Explorer shell, which CF doesn't use, so it won't know about it.  If it's done as a login script... CF will need to be logging with an account that runs that login script (if even service-logins run login scripts?)

    You're better off using a UNC path.  The CF server still needs permissions to see the remote resource though.

    --

    Adam

    BurtleEd
    BurtleEdAuthor
    Known Participant
    February 26, 2010

    Alright I changed it to

    <cfset MyXmlFile = ExpandPath("\\192.168.10.220\shared\COOP\Metwatch\sourceinfo.xml") />

    Still it shows this error

    An error occurred when performing a file operation read on file C:\wwwroot\192.168.0.220\shared\COOP\Metwatch\sourceinfo.xml.

    The cause of this exception was: java.io.FileNotFoundException: C:\wwwroot\131.10.205.178\shared\COOP\Metwatch\sourceinfo.xml (The system cannot find the path specified).