0

I'm running ColdFusion 2016 Std. on Windows Server 2012 R2 Std. There is no Active Domain/Group Policy anything like that running, as I am the one and only person with access to the webserver (small company). I'm logged in as Administrator (locally), and when I look at the properties on the "ColdFusion Application Server" service (under services.msc) the user on the Log On tab is set to: .\Administrator. If I open a new Windows Explorer window and type \\vm00\KCX\cftarget in the address bar (or replace vm00 with the IP address of target machine), it goes straight to it with no issue. I can also create/edit/delete files with no issues on the remote (UNC) share. It is shared with "Everyone" from the remote machine (Windows Server 2008 R2 Std.), and to ensure no issues, I deliberately added \NUC07\Administrator under "Special Permissions" with Full Control (all checkboxes checked) on the remote share (KCX), so that there could be no confusion as to whether the remote admin is included in "Everyone."

Here is my code (originally I used vm00 in place of the IP address, but that produces the same error):

<cfset source="C:\ALT\cfsource\" />
<cfset dest="\\192.168.0.10\KCX\cftarget\" />
<cfif DirectoryExists(source)>
    SOURCE DIR EXISTS.
<cfelse>
    SOURCE DIR DOES NOT EXIST.
</cfif>
<br />
<cfif DirectoryExists(dest)>
    DEST DIR EXISTS.
<cfelse>
    DEST DIR DOES NOT EXIST.
</cfif>
<cffile 
    action="copy" 
    source="#source#cfdata.txt" 
    destination="#dest#" 
/>
DONE.

The output of this code is:

SOURCE DIR EXISTS.
DEST DIR DOES NOT EXIST.

500 Error:
Attribute validation error for tag CFFILE.
The value of the attribute destination, which is currently //192.168.0.10/KCX/cftarget/, is invalid.
The error occurred in testcffile.cfm: line 21 (line 21: source="#source#cfdata.txt")

and yes, the text file does exist, I created it manually.

It seems I'm not the only person who's had trouble with CFFILE action=copy. If anyone has any kind of insight as to what I might be doing wrong, please let me know. Thanks in advance!

Miguel-F
  • 13,450
  • 6
  • 38
  • 63
Brandon G
  • 27
  • 5
  • One would hope that there's a better way by now, but when I had a similar problem years ago where I couldn't get cffile to behave reliably with UNC share paths on my server, I was able to work around this by saving the network share as a mapped drive, so that I could access the share using a drive letter, which then worked fine with cffile. – Sev Roberts Feb 12 '21 at 08:39
  • I don't know your environment so can you clarify - are you attempting to hit that UNC path from the ColdFusion server itself (not your local machine)? Also, have you enabled ColdFusion's sandbox security? If so, you need to add this path for access. – Miguel-F Feb 12 '21 at 13:59
  • @SevRoberts: I changed "\\192.168.0.10\KCX\cftarget\" to "L:\cftarget\" and no joy, same error. I had actually started writing code using the Mapped Ntwk Drive convention, it failed, I googled the issue, and that's where I was led to believe that using UNC share-naming would resolve this issue. Alas, it has not. Thanks for the input anyway. – Brandon G Feb 12 '21 at 16:23
  • @Miguel-F: The web-/CF server is the machine from which I am able to access the UNC share with full permissions with no issue (using Windows Explorer). The code executes from there, and the "source" in the code is the local C: drive on the web-/CF server. I have no issues moving/copying/deleting/creating files on the local webserver. The "target" is a VM (WS2K8R2) full control set on the \KCX\ share for CF server's admin. Under "Sandbox Security" the "Enable ColdFusion Sandbox Security" isn't checked. I added \\192.168.0.10\KCX\ anyway, and still no luck. Thank you for the feedback. – Brandon G Feb 12 '21 at 16:29
  • Adobe never fixed the misleading IOException wrapping that is going on in ``, so the error message is most likely unrelated. My suggestion: Try to access the UNC path with good old [`java.io.File`](https://docs.oracle.com/javase/8/docs/api/java/io/File.html) directly. This will tell you the real reason, why the operation is causing an exception. – Alex Feb 16 '21 at 00:48
  • Thank you all for the suggestions, I was away for a week and am just getting back to work today. @Alex As far as Java goes, I only have passing familiarity. Would something to the effect of: java.io.File.Copy(, – Brandon G Feb 22 '21 at 21:10
  • PS: I'm unsure why my back-slashes (which I use for Windows filesystems) were auto-changed to forward-slashes (which I use for Linux filesystems). – Brandon G Feb 22 '21 at 21:45
  • Thank you for the input so far. At this point, my supervisor is urging me to move forward with a workaround that involves copying the desired files from \\NUC07 (source machine) to a directory on the same server using cffile, then copying from there to a waiting directory on \\vm00 (destination machine) using Windows Task Scheduler and a batch file (xcopy), then sorting the batch-copied files on vm00 locally using cffile again (both machines have CF installed). I'd still like to hear more suggestions for a good fix, as opposed to working around the issue in this manner. – Brandon G Feb 24 '21 at 15:50

0 Answers0